Algorithms and Data Structures · Junior · Question 4 of 75
Why is O(2n + 10) written simply as O(n)?
- 1Because the compiler optimizes the constant factor away
- ✓Correct answer: Because constants and lower-order terms don't change the growth rate
- 3Because Big O only applies to even numbers of operations
Explanation
Big O describes the shape of growth for large n. Multiplying by 2 or adding 10 doesn't change that the cost grows linearly, so both are dropped. In practice constants still matter, which is why benchmarks exist.