Can O(n + logn) be called O(n)? I know that O(n + 5) would be classified as a worst-case runtime of O(n), but can I do that with logn too?

Evelyn Freeman

Evelyn Freeman

Answered question

2022-10-28

Can O(n + logn) be called O(n)?
I know that O(n + 5) would be classified as a worst-case runtime of O(n), but can I do that with logn too?

Answer & Explanation

hanfydded1c

hanfydded1c

Beginner2022-10-29Added 17 answers

Yes, O ( n + log n ) and O ( n ) are the same complexity class, because n + log n O ( n ) and n O ( n + log n )

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?