Binary Search mind map

Halve the search space on sorted data.

Core idea: Find a monotonic yes/no boundary while preserving which side can still contain the answer.

Mnemonic: Invariant → mid → discard · Cost: O(log n) decisions

Locate: Exact match

Signal: A sorted domain can discard half after one comparison.

Move: Choose a closed or half-open interval and keep its membership invariant consistent.

Examples: Binary Search, Search Insert Position, Guess Number

Bound: First true / last false

Signal: Many answers satisfy a monotonic predicate, but one boundary matters.

Move: Keep the possible boundary inside the interval and bias mid when progress requires it.

Examples: First and Last Position, Lower Bound, First Bad Version

Decode: Hidden order

Signal: The array is rotated, mountain-shaped, or partitioned.

Move: Identify the ordered half or local slope, then retain only the side compatible with the target.

Examples: Search Rotated Array, Find Minimum, Find Peak

Answer: Search the answer space

Signal: A candidate value has a cheap monotonic feasibility check.

Move: Binary-search the value; let one linear pass prove whether the candidate is possible.

Examples: Koko Eating Bananas, Ship Capacity, Split Array Largest Sum

Every mind map