Skip to content
Computer Science

Big O Notation

A way to describe how the running time or memory of an algorithm grows with the size of its input.

5 min readUpdated July 15, 2026

What it measures

Big O notation captures the upper bound on how an algorithm scales. It ignores constants and small terms so we can compare algorithms on how they behave when inputs are large.

Common classes

O(1) constant, O(log n) logarithmic, O(n) linear, O(n log n) linearithmic, O(n²) quadratic, and O(2ⁿ) exponential. Sorting a list of a million items with an O(n²) algorithm is roughly a trillion operations — impractical.

Why it matters

Choosing the right algorithm can turn a program that takes hours into one that finishes in seconds. Big O gives us a shared language for that trade-off.