Searching Algorithms
Lesson 5 of 20Hunt for 55 in a sorted array and watch binary search shrink the window in half at every comparison.
Ten sorted scores, one target. Watch low, mid and high corner it in three comparisons.
One loop, one compare, one halve — the whole algorithm fits in a handful of boxes.
The same hunt in real C++ — binary search first, then the linear scan for comparison.
Same array, no sorted order — linear search must peek into every box until it stumbles on 55.
Trace low, mid and high by hand before you guess — integer division matters.
Click a term, then click its meaning to lock the pair.