Most people learn binary search as “finding a value in a sorted array” and stop there, which means they miss the far more valuable version of the skill: binary search is really a technique for eliminating half of a search space on every step, and a search space doesn’t have to be a literal sorted array of values you’re looking up.
Most people learn binary search as “finding a value in a sorted array” and stop there, which means they miss the far more valuable version of the skill: binary search is really a technique for eliminating half of a search space on every step, and a search space doesn’t have to be a literal sorted array of values you’re looking up. It can be a range of possible answers to a question like “what’s the smallest workable value of X” — a completely different shape of problem that happens to have the same exploitable structure. Recognizing that structure, independent of whether an array is involved at all, is what separates candidates who can only solve the textbook version of binary search from candidates who can apply it broadly.
The signal to watch for is more subtle than “the input is sorted.” Watch instead for monotonicity: is there some quantity that only increases (or only decreases) as you move through the search space, such that a “does this candidate work” check flips from false to true (or true to false) exactly once, with no flipping back and forth? A sorted array trivially has this property with respect to value. A rotated sorted array still has enough structure to exploit, even though it isn’t globally sorted, because at least one half of any given split is always properly sorted. A 2D matrix sorted along both rows and columns has monotonicity along a diagonal-ish traversal path. And — the biggest conceptual leap in this article — a question like “what’s the smallest possible value of the maximum workload, if I get to choose how to split tasks among workers” has monotonicity too: as the candidate “max workload” ceiling increases, whether it’s achievable flips from “no” to “yes” exactly once. That’s binary search on the answer, and it doesn’t require any array to search through at all — just a way to test a candidate answer and a starting range for the search.
These techniques do not apply when there’s no monotonic structure to exploit at all — if a “does this work” check can be true, then false, then true again as the candidate value increases, halving the search space in either direction can eliminate the wrong half, and you’d get a wrong answer with no indication anything went wrong. Confirm monotonicity exists (either through the problem’s guarantees or your own reasoning about it) before committing to a binary search approach.
Continue with the book
Explore the full treatment, worked examples, and exercises in Algorithmic Edge.
Companion article for Algorithmic Edge, published by Choral Software. Article text and original examples © 2026 Choral Software. All rights reserved.
