Workspace Binary Search
0d
Problem-solving patterns

Exact Binary Search

Halve a sorted candidate interval after each unsuccessful probe.

Recognition signal

The array is sorted by the same comparison used in search.

Method

Probe the midpoint and discard it along with the impossible side.

Worked example

With target 10 in [2, 6, 10], reading 6 discards indices 0 and 1.

Common mistake

Updating a closed endpoint to mid can prevent termination.