Binary search
Lesson 3 of 20 · Algo.Micro
On a sorted list, check the middle and throw away half. 1,000,000 items need about 20 looks.
In a dictionary you never read page by page: you open in the middle and decide which half to keep. That only works because the words are sorted.
Check yourself
What must be true for binary search to work?
Do it in the browser: a real algorithms tool, a short mission and instant feedback. No install.
Start this lesson — free