What is Olog N?
Data Structures & Algorithms practice on Codemia
Step through 300 algorithm problems with animated visualisers that show the data structure changing as the code runs.
Introduction
When someone writes Olog N in plain text, they almost always mean O(log N), or logarithmic time complexity. It describes algorithms whose work grows very slowly as the input grows. The classic example is binary search, where each step cuts the remaining search space roughly in half.
What O(log N) Means
Big O notation describes how running time or memory usage scales with input size. O(log N) means the number of steps grows in proportion to the logarithm of N, not to N itself.
A logarithm answers the question: how many times can you repeatedly divide by a base before you reach 1?
That is why logarithmic algorithms are fast even for large inputs.
Binary Search Is the Standard Example
Binary search on a sorted array is the clearest O(log N) example.
Each loop throws away half the array, so the number of iterations grows with log N rather than N.
Why Logarithmic Growth Is Small
If N doubles, an O(N) algorithm roughly doubles its work. An O(log N) algorithm only adds a tiny amount of extra work.
For example:
- '
log2(8) = 3' - '
log2(1024) = 10' - '
log2(1,048,576) = 20'
That is why logarithmic algorithms scale so well. Huge inputs do not automatically mean huge running times.
Base Usually Does Not Matter in Big O
You may see log2 N, log10 N, or natural log. In Big O notation, the base is usually ignored because changing log bases only multiplies the result by a constant factor.
So O(log2 N) and O(log10 N) are both written simply as O(log N) in asymptotic analysis.
Do Not Confuse O(log N) with O(log* N)
A common source of confusion is the iterated logarithm, written O(log* N), which is an even slower-growing function used in a few specialized analyses.
If the text says only Olog N or O(log N), it almost certainly means ordinary logarithmic complexity, not iterated logarithm complexity.
Other Common O(log N) Situations
Besides binary search, logarithmic complexity often appears in:
- balanced binary search trees
- heap operations such as insert and delete
- divide-and-conquer recursion depth
- exponentiation by repeated squaring
For example, a heap insertion bubbles an element up through the tree height, which is logarithmic in the number of nodes.
Why This Complexity Usually Implies Structure
O(log N) behavior usually comes from one of two ideas:
- discarding a constant fraction of the problem each step
- navigating a balanced hierarchical structure
If the algorithm is not cutting the problem down aggressively or traversing a balanced tree-like shape, it probably is not logarithmic.
Common Pitfalls
- Reading
Olog Nas a strange new notation when it is usually just plain-text shorthand forO(log N). - Confusing
O(log N)withO(log* N), which is a different and rarer complexity class. - Assuming logarithmic time means the algorithm is always trivial or free for all practical purposes.
- Forgetting that binary search requires sorted data, even though its complexity is logarithmic.
- Ignoring the data structure assumptions, such as tree balance, that make logarithmic performance possible.
Summary
- '
Olog Nalmost always meansO(log N).' - '
O(log N)describes logarithmic growth, where work increases very slowly as input grows.' - Binary search is the standard example because it halves the search space each step.
- The base of the logarithm is usually ignored in Big O notation.
- Do not confuse ordinary logarithmic complexity with iterated logarithm complexity.
Related reading
- What is plurality classification in decision trees?
- What is pseudopolynomial time? How does it differ from polynomial time?
- What is search.twitter.com's trending topics algorithm?
- What is Sliding Window Algorithm? Examples?
- What is performance of ContainsKey and TryGetValue?
- What is std::move(), and when should it be used?
- What is stability in sorting algorithms and why is it important?
- What is tail call optimization?

DSA Fundamentals
Master algorithmic patterns and data structures through hands-on LeetCode-style problems - from arrays and hashing to dynamic programming and advanced graphs.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Data Structures & Algorithms practice on Codemia
Step through 300 algorithm problems with animated visualisers that show the data structure changing as the code runs.