Practice mode Data Structures

If an algorithm takes 3n² + 5n + 20 steps for an input of size n, what is its Big-O complexity?

Correct answer D. O(n²)

Explanation

Big-O keeps only the fastest-growing term and drops constant factors. For large n, 3n² dominates 5n and 20, and the constant 3 is discarded, giving O(n²). Writing O(3n²) is not wrong mathematically but is not the simplified form expected. O(n³) is a valid upper bound yet not a tight one, so it is not the best answer.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.