Back to Discover
Spark

Why Big-O Ignores Constants

Big-O ignores constants because it describes how runtime scales with input size, and any fixed multiplier becomes irrelevant once the input grows.

Before you enter

A complete interactive classroom, not just a preview.

Start when you are ready to enter this Stage's 4 scenes and explore, respond, and learn as you go.

4
Scenes
8 min
Estimated
Content language: en-US
Start this Stage
Sign-in may be required to play
What happens inside
  1. 01Two algorithms, one verdictslide
    Slot 1Hook

    Two students each write an O(n log n) sort. Student A's implementation sorts 1,000 items in 5 seconds; Student B's takes 10 seconds on the same laptop. The class labels both as 'the same complexity.' Is that fair?

    • Both algorithms have identical formal big-O class
    • Measured running times differ by a factor of 2
    • Textbook says they are equivalent — but the stopwatch disagrees
    Phenomenon

    Two implementations of the same algorithm class show a 2× measured gap on identical input.

    Question

    If big-O puts them in the same bucket, what exactly is big-O measuring that the stopwatch isn't?

  2. 02What does the stopwatch disagree with?interactive
    Slot 2Tension

    Predict which curve wins at small n and which wins at large n, then drag the input-size slider.

    • Toggle between constant = 1 and constant = 10 on the same n log n formula
    • Watch the gap shrink relative to an n² curve as n grows
    • Notice that the constant disappears in the curve's shape, not in the runtime
    Prediction

    Doubling the constant should roughly double the running time at every input size — so the slower curve stays slower forever.

    Tempting intuition

    Because the constant affects real time at every n, big-O must be wrong, incomplete, or just a rough approximation.

  3. 03Big-O measures scaling, not speedslide
    Slot 3Reveal

    Big-O asks: 'as n grows without bound, what's the dominant pattern of growth?' A constant multiplies runtime but never multiplies n, so the shape of the curve is set by the term attached to n — not the constant in front.

    • Definition focuses on behavior as n → ∞, not at any fixed n
    • Constant factor shifts the curve up or down but does not change its slope class
    • An O(n²) algorithm will eventually overtake any O(n log n), even with terrible constants
    Evidence

    The simulation shows the n² curve falling behind at small n but crossing and dominating beyond a crossover point — and that crossing is determined by the n² vs. n log n terms, not by the constant multipliers.

    Conclusion

    Big-O ignores constants because constants describe today's hardware and code style, while the notation answers a different question: how does cost behave when the input grows?

    Mechanism
    1. 1Big-O only retains the term with the highest growth order because, at large n, that term dominates the sum regardless of its coefficient.
    2. 2A fixed constant factor stays fixed; it cannot 'outrun' a function of n once n is large enough, so it is discarded by the definition.
  4. 04Read it as a scaling questionslide
    Slot 4Takeaway

    When a problem is reframed so that the input size doubles every iteration — server traffic growing year over year — apply the rule: ask which growth class wins, not which constant is smaller today.

    • Identify the growth class first (n, n log n, n²)
    • Treat the constant as unknown hardware-dependent tuning
    • Re-derive the comparison under the 'n gets much larger' assumption
    Transfer

    A startup's user base grows 5× per year while its engineering team grows 2×. Each user request still costs c·n log n time. Should the team worry about the constant c or the growth class n log n?

    Expected inference

    The constant can be tuned away — better servers, caching, language rewrites — but n log n grows with the user base, so the team should treat the growth class as the real threat and the constant as a short-term lever.

Discussion

Discussion threads for a Stage aren't available yet.

Where this leads
Explore more

More in Math & Logic

See all