Skip to content
Data Structures & Algorithmsbeginner · 35 min

Searching Algorithms

Binary search is the workhorse: O(log n) on sorted data, and a pattern far beyond plain lookup — 'binary search on the answer' solves many optimization problems.

Binary search on the answer

Many 'minimize/maximize X subject to a monotonic feasibility check' problems (e.g. 'minimum capacity to ship in D days') are solved by binary-searching the answer space and testing feasibility — a powerful, frequently-tested generalization.

Resources

Practice & test yourself

Take the quiz →