OCR A LEVEL · SORT

Insertion sort.

Take the next value and insert it into the sorted left side.

All H446 lessons
THE VISUAL TRACE

Follow the values

00 / 29
Ready to explore

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

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

What should you notice?

The left side stays sorted as each next value is inserted into its correct place.

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 H446 lessons ↗