binary-search-variants-share-convergence-structure

Status: IN

All binary search solutions share the same convergence loop structure (narrow [lo, hi] until they meet) but vary along three independent dimensions: what is searched (raw values vs. derived monotonic functions), bias direction (leftmost vs. rightmost match), and post-loop extraction (lo, hi, or result variable).

Justifications

the four patterns are orthogonal specializations of one template — search-target and bias are independent choices, and recognizing the shared structure reveals that any new binary search problem maps to a point in this 2D design space

Depends on (SL): binary-search-on-derived-quantities-pattern, binary-search-on-value-pattern, left-biased-binary-search-pattern, fixed-point-uses-leftmost-binary-search

Depended on by

JSON