Algorithms and Data Structures · Junior · Question 4 of 75

Why is O(2n + 10) written simply as O(n)?

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.

Further reading

Problem with a question

Algorithms and Data Structures · Junior · question 4

Test yourself

Take the Algorithms and Data Structures · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz