Math Fundamentals18 sections · 814 units
Open in Course

O(log n) - Logarithmic Time

(Halving search space)

An algorithm is O(log n) if it cuts the problem size in half with each step. Binary search is the classic example.

Logarithms grow incredibly slowly. Doubling input size adds just one more step. An array of 1 billion elements needs only about 30 comparisons.

Any time you divide and conquer by half, you see logarithmic complexity.