Binary Search — step-by-step

Core rule: Binary search works only on a sorted array. Each step cuts the search space in half.

Mental model

Keep two pointers: low and high. Check the middle. Move left or right depending on the key.

Common mistakes

← Back to Notebook