Look at the middle, discard the half that can't contain it. O(log n) on sorted data.
21 elements, target 30 → found in 5 probes. Blue window halves every step.
Linear scan climbs and drops off the chart. Binary/bisect stay flat.
(lo+hi)/2 overflow (lived in the JDK for years)bisectSearch sorted data with a logarithm, never a scan. Generalizes to "binary search on the answer". Next: quickselect.