Tutelage

Lessons › coding and computer science · taught by Leo

Big O growth: why constants don’t matter

Learn how Big O describes algorithm growth, drops constants, and helps compare common classes like O(1), O(n), and O(n^2).

Learn this with Leo, freeA voiced lesson with a live whiteboard, quizzes and a tutor you can call, at tutelage.app

Why Big O ignores tiny details

Big O is a shortcut for how fast something grows when the input gets big.

We care about the shape of the growth, not tiny extra costs at the start.

Big O compares growth rates

Big O describes an upper growth trend as input size increases.

If one algorithm takes about n steps and another takes about n squared steps, the n squared one grows faster for large n.

Big O helps you compare algorithms without getting lost in exact timing on one machine.

Predict the growth idea

If n gets very large, which grows faster: n or n²?

  1. n
  2. n²
  3. They grow the same
Show answer

n²: Yes. n² grows faster as n gets large.

A tiny counting example

Let’s look at 3n plus 4. The 3 and the 4 matter for exact cost, but Big O only asks what grows with n.

So we keep the n part and write O of n.

Quick check: what do we keep?

For 5n + 12, what is the Big O?

  1. O(5n + 12)
  2. O(n)
  3. O(12)
Show answer

O(n): Correct. Big O keeps the growth term, so this is O of n.

Why constants disappear

Two programs can have different exact counts, but the same Big O.

That is why Big O is useful: it tells you the long-run pattern.

Common classes to know

These are the most common growth classes: O(1), O(log n), O(n), O(n log n), O(n²).

Constant, logarithmic, linear, n log n, and quadratic are the big ones to recognize.

As you move right, growth usually gets slower to faster.

Growth ladder

Think of this like a ladder. Each step is usually a faster-growing class.

If you can spot where a program fits on this ladder, you are already doing a lot of Big O work.

Quick check: spot the class

A loop that checks every item once is usually what Big O?

  1. O(1)
  2. O(n)
  3. O(n²)
Show answer

O(n): Right. One pass over n items is linear, so O of n.

Watch for nested loops

A common mistake is to forget nesting. One loop inside another often multiplies the work.

That is how you end up with n times n, which is n squared.

Your turn: nested work

Two nested loops each run n times. What is the Big O?

  1. O(n)
  2. O(n log n)
  3. O(n²)
Show answer

O(n²): Yes. n times n gives n squared, so O of n squared.

Big O checklist

Here is the checklist: find the main growth term, drop constants, drop smaller terms, then name the class.

If you practice that flow, Big O gets much easier fast.

Learn this with Leo, freeA voiced lesson with a live whiteboard, quizzes and a tutor you can call, at tutelage.app