Skip to content
Know.itKnow.it
Create an animated lesson
On request

This article is free to read. Creating a lesson uses your daily or stored credits; review the language and settings before starting.

What is Big O notation?

TechnologyLesson on requestFree to read

Quick answer

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.

Key things to understand

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

People also ask

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.