๐ก Interactive lessons ยท free, no sign-up
Binary search, find anything by halving
Play Binary Search
Loading Binary Searchโฆ
How to play Binary Search
- Read the first step: guess the middle and throw half away.
- Move the sliders and switches to change the diagram and watch what happens. The readout under the picture shows the numbers.
- Answer each question. If you are wrong you get a hint and can try again, with no penalty.
- Some steps ask you to make something happen, such as hitting a target value. Experiment until it works.
- Finish the lesson to earn XP and see how many questions you got right first time.
Tips and strategy
- Do not rush. The controls are there to be played with, so try extreme values as well as sensible ones.
- Say what you notice out loud or write it down before you press Continue.
- Use the hint when you are stuck, and then try to explain the answer in your own words.
- Each guess should cut the possibilities in half, so guess the middle.
Keep playing
More games you might like
Coding games ยท Ages 10+NewSorting VisualizerWatch bubble, insertion and selection sort organise a row of numbers.
algorithmssorting
Play
Coding games ยท Ages 10+NewPathfinding VisualizerDraw walls and watch breadth-first search find a shortest grid path.
algorithmsgraphs
Play
Interactive lessons ยท Ages 9+NewDoubling and Powers of 2Watch doubling explode: 1, 2, 4, 8 ... 1,024, and learn what 2 to the power n means.
powers of 2exponents
Play
Puzzle & board games ยท Ages 7+NewTower of HanoiMove the tower one disk at a time, never a big disk on a small one. Classic, scrambled and 4-peg towers.
Classic โ Mid-game โ Variants
Start the adventure
FAQ
Binary Search: questions
What is binary search?
A fast way to find something in a sorted list by always checking the middle and discarding half of the remaining items.
Why must the list be sorted?
Because knowing the middle item is too high or too low only tells you about the other half if the list is in order.
How many guesses does it take?
About log base 2 of the list size: 5 for 32 items, 10 for 1,024, and about 20 for a million.
What age is this lesson for?
It suits ages 10 to 16 and anyone starting computer science.
Start a conversation
Questions about classes?
A parent or guardian can share the learner's age, level and goals, and we'll suggest a starting point and confirm the format before anything is booked.
- Tell us the learnerโs age or grade and goals
- Weโll suggest a suitable class or learning path
- Weโll confirm format, timing and fees with a parent or guardian