Skip to content
Technology

What is Big O notation?

Big O notation is a way to describe how an algorithm's running time or memory grows as the input gets bigger. It focuses on the worst-case trend — like 'doubles when the input doubles' — so you can compare algorithms regardless of the computer.

See it, don’t just read it.
Watch a 2-minute lesson with voice + animation that explains big o notation.
▶ Watch the visual lesson

Key things to understand

  • 1It expresses how cost scales with input size, ignoring constant details.
  • 2O(n) grows in step with the input; O(n²) grows much faster; O(log n) grows slowly.
  • 3It captures the worst-case behavior for large inputs.
  • 4It lets you compare algorithms' efficiency independent of hardware.
  • 5Choosing a lower-order algorithm is what keeps software fast at scale.

Frequently asked questions

What does O(n) mean?
The work grows in direct proportion to the input size — double the data, double the time.
Why ignore constants in Big O?
For large inputs the growth rate dominates; whether a step takes 2 or 5 operations matters far less than whether cost grows linearly or quadratically.
Is a lower Big O always better?
Usually for large inputs, but for small inputs a 'worse' Big O algorithm with low overhead can actually run faster.

Related topics