Binary search and its invariant
On a sorted random-access array, compare the target with the middle key and discard the half that cannot contain it; repeat until a matching key is found or the remaining interval is empty.
Key knowledge
On a sorted random-access array, compare the target with the middle key and discard the half that cannot contain it; repeat until a matching key is found or the remaining interval is empty. Every step preserves all possible matches within the interval and halves its size.
Conditions and scope
- Keys use a consistent total ordering and comparisons are bounded-cost.
- Worst-case comparison count is O(log n); sequential access and variable-length key comparisons change the cost model.
Sources · 1
References
Sources retain their recorded scope. A source link alone does not establish verification of every statement.
Evidence and review
Lecture 3 transcript pages 4–5: sorted-array search, halving and logarithmic bound.
2026-10-10 · Independent AI editorial review: All241 compact claims, hypotheses, displayed equations/conventions and all596 origin semantic links read; entire241-entry author exact-source inspection matrix and declared limitations reviewed. Prior105 actual inherited Mathematics/Information records read for whole-inventory breadth. Targeted independent primary sections are listed below; this does NOT claim every cited source body or every proof was independently re-read. This is AI reference-content review, not human disciplinary certification, exhaustive textbook reproduction or experimental replication. Receipt: mathematics-information-independent-content-review.1.
Entry details
Permanent link to this entry ↗- Record identity
- info-binary-search
- Revision
- university-core.1
- Structured reference record
- University core expansion