Caffeinated Coder
Book an appointment
Lesson 18 · Algorithms

Searching: linear and binary

Finding one number in a list sounds simple, and it is: check each item until you find it. But on a sorted list there is a much faster way. Step through a search for 42 in a sorted list of 16 numbers, first one by one, then with binary search, which looks at the middle and throws away half the list each time.

10 min10 steps5 questionsIntermediate
Fig 18 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.