04 Try it yourself Interactive

Watch the window halve

Press Next one step at a time. The amber band is the live window; faded bars have been eliminated and are never read again. The raised bar is the element being read this pass. Switch tabs to see exactly what changes when the target repeats.

Plain binary search
stops on the first match it lands on
2–9 whole numbers (0–99). They get sorted for you.
Press Next to begin. Each press moves one step.


      
Low
High
Search space0
Reads0
step 0 / 0