Explain why Big-O notation drops constant factors (like the 3 in O(3n²)), and why this makes the notation useful for comparing algorithms.
Think about your answer, then reveal below.
Model answer: Constant factors depend on hardware, compiler, and implementation details — they are not intrinsic to the algorithm. An O(n²) algorithm runs twice as fast on hardware that is twice as fast, but it is still O(n²). By absorbing constants, Big-O captures the growth shape that persists regardless of these extrinsic factors. This makes cross-algorithm comparison meaningful: saying one algorithm is O(n) and another is O(n²) tells you that the first will eventually outperform the second on any hardware, for large enough inputs, regardless of how the constants differ.
Big-O answers 'how does this scale?' rather than 'how fast does this run on my laptop?' For small inputs, the constant matters enormously — an O(n²) algorithm with a tiny constant might beat an O(n log n) algorithm with a large constant. But as n grows, the growth rate dominates. The notation is designed for the scaling question, and for that question, constants are irrelevant. This is also why recognizing complexity class is the first step in algorithm evaluation: it tells you whether the algorithm is even in the right ballpark for large inputs before you worry about constants.