Coding activity
Sorting Race
Line up in order! Sort yourself, toys, or family members from shortest to tallest, youngest to oldest, or smallest to biggest. Practice putting things in the right order.
Materials and setup
- numbered cards
- timer
- paper for tracking
How this changes by age
Pre-K (ages 3–4)
Line up in order! Sort yourself, toys, or family members from shortest to tallest, youngest to oldest, or smallest to biggest. Practice putting things in the right order.
Steps
- Gather 5 stuffed animals or toys of different sizes.
- Ask: 'Can you line them up from smallest to biggest?'
- Child picks up each one, compares, and places them in order.
- Check together: 'Is this one smaller than that one? Yes! Great sorting!'
- Try again with a different rule: lightest to heaviest, or darkest to lightest color.
- Tell a grown-up one thing that surprised you.
Learning objectives
- Compare two objects and determine which is bigger or smaller
- Arrange items in order from least to greatest
- Practice sorting by different attributes (size, weight, color)
Kindergarten (ages 5–6)
Race to sort numbered cards in order! Learn the strategy of finding the smallest first, then the next smallest. Compare different sorting methods to see which is faster.
Steps
- Shuffle 10 numbered cards (1-10). Spread them face up on the floor.
- Method 1 (Selection Sort): Find the smallest number, put it first. Find the next smallest, put it second. Time yourself!
- Shuffle again. Method 2 (Insertion Sort): Pick up cards one at a time, sliding each into its correct spot in your growing sorted line.
- Which method felt faster? Which was easier to understand?
- Race a family member: one uses Method 1, the other uses Method 2. Who finishes first?
- Tell a grown-up one thing that surprised you.
Learning objectives
- Sort numbered items using a systematic step-by-step method
- Compare two different approaches to solving the same problem
- Experience that there are multiple valid strategies for organizing data
Early elementary (ages 6–8)
Become a sorting algorithm! Act out bubble sort, selection sort, and insertion sort as physical races. Compare how many swaps each algorithm needs and discover which is most efficient for different situations.
Steps
- Give 8 players (or stuffed animals in a line) random number cards. Goal: sort them in order without seeing all cards at once.
- Bubble Sort: compare neighbors, swap if out of order, repeat until sorted. Count every swap. Time it!
- Selection Sort: find the minimum, swap it to position 1. Find the next minimum, swap to position 2. Count swaps.
- Insertion Sort: take each card one at a time and insert it into its correct position among the already-sorted cards.
- Record for each: total swaps and total time. Make a comparison chart.
- Discuss: 'Which is best for nearly-sorted data? Which is best for completely random data? Programmers choose algorithms based on the situation!'
- In one sentence, tell a parent or sibling what surprised you today.
Learning objectives
- Execute bubble sort, selection sort, and insertion sort through physical demonstration
- Count and compare the number of operations each algorithm requires
- Analyze which sorting algorithm is most efficient for different starting conditions
Upper elementary (ages 8–10)
Study sorting algorithms like a computer scientist. Analyze time complexity, implement merge sort and quicksort on paper, and understand Big O notation. Design experiments to measure algorithm efficiency with different data sizes.
Steps
- Review bubble sort and count operations for lists of 5, 10, and 20 items. Notice: doubling the list roughly quadruples the work. This is O(n squared).
- Learn merge sort: split the list in half, sort each half, merge them back. Walk through a 8-element example step by step on paper.
- Learn quicksort: pick a pivot, put smaller items left and larger items right, repeat for each side. Walk through an example.
- Compare: sort the same 16 random numbers using bubble sort and merge sort. Count comparisons for each. Merge sort wins!
- Big O notation: O(n squared) means slow for big lists (bubble, selection). O(n log n) means fast (merge, quick). Draw graphs showing the difference as list size grows.
- Real-world application: when you search for a song, the app sorted millions of songs. Why does algorithm choice matter at scale?
- In one sentence, tell a parent or sibling what surprised you today.
Learning objectives
- Trace through merge sort and quicksort algorithms step by step
- Compare algorithm efficiency using operation counts for different input sizes
- Understand Big O notation as a way to express algorithm performance at scale
Safety and evidence note
Read the full activity before beginning. An adult should supervise tools, heat, food, outdoor work, movement, and experiments as appropriate. Completion records that the activity was done; the child’s explanation, work sample, photo, or demonstration is stronger evidence of learning than a completion check alone.
Related coding activities
AI Explorers
Train a pretend 'robot brain'! Show it 5 cat pictures and 5 dog pictures, then test if it can guess a new one.
Algorithm Art
Follow step-by-step drawing instructions to create a picture. The instructions are your algorithm! Each step adds one shape or line.
API Restaurant
Play restaurant! The customer tells the waiter what they want, the waiter tells the kitchen, and the kitchen makes it. The waiter is the messenger — just like how computers talk to each other!
App Design Workshop
Design your dream app! Draw what you'd see on a phone screen. What would your app do? What buttons would it have?