All articles

Coding practice, 6 min, October 30, 2026

Big-O notation, explained without the math headache

Big-O is just a way to describe how slower a program gets as the input grows. Here is the intuition, the common classes, and how to talk about it in an interview.

A rising curve on a grid, representing growth rate

Big-O sounds mathematical, but the idea is simple: it describes how the amount of work grows as the input gets bigger. It ignores constants and small terms because, at scale, only the growth rate matters.

The classes you will actually meet

  • O(1) — constant: the same work no matter the size (a hash-map lookup).
  • O(log n) — logarithmic: halving the problem each step (binary search).
  • O(n) — linear: one pass over the input.
  • O(n log n) — the cost of good sorting.
  • O(n²) — nested loops over the same data; fine for small n, painful for large.
  • O(2ⁿ) — exponential: usually a sign you need a better approach.

A quick way to estimate

Count the loops. One pass over the data is O(n). A loop inside a loop over the same data is O(n²). Each time you halve the search space, add a log n. Recursion that branches twice per call trends toward exponential.

“Big-O is not about the stopwatch. It is about how the stopwatch changes when the input gets ten times larger.”

Talking about it in an interview

State the time and space complexity of your solution before you are asked, and say whether you think it can be improved. Interviewers care less about the perfect answer than about whether you can reason about cost out loud.

Try it on your next question

Reptor reads a question on your screen and answers it with the model you choose — plus a short explanation so it sticks.

Download Reptor