CAMBRIDGE AS & A LEVEL · SORT

Bubble sort.

Compare neighbours and move the larger value right on each pass.

All 9618 lessons
THE VISUAL TRACE

Follow the values

00 / 30
Ready to explore

Press Play or Next step to begin. No values have been checked yet.

[
7
1
2
2
9
3
4
4
1
5
6
6
]
current checked / fixedindex starts at 1
NOW IN THE ALGORITHMPress Play to begin.
01 / THE IDEA

What should you notice?

After each pass, the largest remaining value is fixed at the right edge.

02 / KEEP PRACTISING

Change the outcome.

Try a first value, a last value, a missing target, duplicates, negative numbers, and a single value. Use the slider to revisit any step.

Explore more 9618 lessons ↗