AlgoGymPreparationInterview Preparations
Cool NotesBinary search invariants
All notes

Binary search invariants

Algorithms · Original AlgoGym revision note with a source for deeper study.

Algorithms
  1. Define a monotonic predicate before searching for a boundary.
  2. Keep the invariant explicit: one side known false, the other known true.
  3. Choose midpoint and termination rules that cannot repeat the same interval forever.
Read more at CP-Algorithms