Sorting step by step

Ages 6 to 8 Read together, then try alone · about 20 minutes

Read together

A computer follows steps, called an algorithm, to solve a problem.

Sorting puts things in order. One way is to compare neighbours and swap them if they are in the wrong order.

We can do this with cards and no computer at all.

Do it

  1. Write the numbers 1 to 8 on cards. Mix them up in a row.
  2. Compare two neighbours at a time from the left. If the left one is bigger, swap them.
  3. Go along the whole row, then repeat until no swaps are needed. Count how many rounds it took.
  4. Try again with another set. Write the steps so someone else can follow them.

Talk about it

For the grown-up

This is a version of a real sorting method called bubble sort. Computer scientists compare different ways to sort, because some are much faster than others. Activities like this can be done without any computer.

← Previous lesson Next lesson →

Where this comes from
  • Tim Bell, Ian H. Witten and Mike Fellows, Computer Science Unplugged (University of Canterbury, New Zealand), sorting algorithms activities
  • Code.org, CS Fundamentals unplugged activities on algorithms

Written with AI assistance and checked against the sources listed. Please read it before sharing it with a child.