AQA A LEVEL · SEARCH
Binary search.
Halve the remaining search range in a sorted list.
THE VISUAL TRACE
00 / 06Follow the values
Ready to explore
Press Play or Next step to begin. No values have been checked yet.
[]
3
07
111
218
325
431
542
6 current checked / fixedindex starts at 0
SEARCH TARGET25
NOW IN THE ALGORITHM
Press Play to begin.01 / THE IDEA
What should you notice?
Binary search only works correctly when values are sorted. Watch how each comparison rules out half of the remaining positions.
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 7517 lessons ↗