Algorithm Analysis
Big O Notation
Computational Complexity
Logarithmic Functions
Asymptotic Notation

What is Olog N?

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

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.

python
1def binary_search(values, target):
2    left = 0
3    right = len(values) - 1
4
5    while left <= right:
6        mid = (left + right) // 2
7        if values[mid] == target:
8            return mid
9        if values[mid] < target:
10            left = mid + 1
11        else:
12            right = mid - 1
13
14    return -1
15
16print(binary_search([1, 3, 5, 7, 9, 11], 7))

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 N as a strange new notation when it is usually just plain-text shorthand for O(log N).
  • Confusing O(log N) with O(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 N almost always means O(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.

Course illustration
Course illustration

All Rights Reserved.