Learn CS Visual

How Complexity Works

Complexity describes how the operation count grows as the input size n grows. O(1) stays constant no matter how large n gets, O(log n) grows only as many times as you can halve n before reaching 1, O(n) grows in direct proportion to n, and O(n²) grows steeply. Even for the same problem, the algorithm you choose can change which of these growth patterns you get.

When n=16, roughly what's the operation count for O(log n)?