Least You Need to Know: Binary Search Invariants and Boundary Updates
Lecke megnyitása
Binary search works because the search interval maintains an **invariant**: the desired answer is still inside the remaining range. Each comparison must eliminate only the half that is provably impossible, and the boundary update must match the exact question being asked.