Binary search

How fast can you find a word in a dictionary?

Binary search

How fast can you find a word in a dictionary?

Imagine you're looking for a word in a dictionary. You flip through pages, but the dictionary is sorted alphabetically.

Instead of flipping through each page, you open the dictionary in the middle and see if the word you're looking for is there. If not, you decide if it's alphabetically before or after the middle word and flip through the relevant half. You repeat this until you find the word.

Example

If the dictionary has 1024 words, you might need to flip through 10 pages (since log base 2 of 1024 is 10) to find your word.

Remember this

Binary search cuts the search area in half each time, making it much faster than flipping through the entire dictionary.

Related concepts

Swipe through 100 ML concepts daily

Open Pocket Polymath