Ignoring constant factors

[comp1110-2C]

The Big O Notation ignores constant factors, and this is usually the correct approach. An algorithm that takes \(3n\) steps and one that takes \(100n\) steps are both linear (\(\mathrm {O}(n)\)). The second is slower, but if the input size doubles, both running times double. Big-O focuses on this growth behaviour, because for large inputs the growth rate matters far more than constant multipliers. A quadratic algorithm in \(\mathrm {O}(n^2)\) will eventually be far slower than any linear algorithm, even if the linear one has a large constant factor.

bars magnifying-glass caret-down plus minus arrow-right xmark