Ignoring Constants in Big-O
What You'll Learn
You'll learn why Big-O notation ignores constant multipliers and focuses only on the shape of growth as input size increases.
The Core Idea
In Big-O analysis, we drop constant factors like 2, 5, or 100 from our expressions. For example, if an algorithm takes exactly 5n + 3 operations, we say it's O(n), not O(5n + 3). Similarly, 100n and n/2 are both just O(n).
Why? Because Big-O describes how runtime scales as input size grows toward infinity, not the exact time for any specific input. Constants become insignificant when comparing growth rates.
An Analogy
Imagine two runners: one runs at 5 mph, another at 100 mph. Both move at a constant speed. Now compare them to someone whose speed doubles every mile (exponential growth). Initially, the 100 mph runner is fastest—but eventually, the exponentially-accelerating person will leave both far behind. The rate of acceleration matters more than the starting speed when we're looking at the long-term picture.
Similarly, an algorithm that takes 100n steps will eventually be faster than one taking n² steps, even though 100n might be slower for small inputs. Big-O cares about this long-term behavior.
Why Constants Don't Matter
- Constants depend on hardware, programming language, compiler optimizations—things outside the algorithm itself
- When
ngets large enough, the dominant term (the one growing fastest) overwhelms any constant factor 2nand1000ngrow at the same rate—both are linear
We already learned that dominant terms matter most. Constants are dropped for the same reason: they don't change the fundamental growth pattern.
Key Takeaway: Big-O ignores constant multipliers because it focuses on growth rate, not exact operation counts—constants become negligible as input size increases.