What is the Big oh of n^2+nlog(n)? prove your answer. How do I choose the big oh notation is it n^2 or nlog(n) what is the strategy to choose?
and if I choose nlog(n) how would I solve it?
What is the Big oh of n^2+nlog(n)? prove your answer. How do I choose the big oh notation is it n^2 or nlog(n) what is the strategy to choose?
and if I choose nlog(n) how would I solve it?
You seem to know that when you sum two functions, the Big O is the Big O of the "larger" function (for arbitrarily large n), so we just need to find which of the two functions that is. To do this, we can solve the following limit:
lim (n -> inf) n^2 / nlog(n)
= lim (n -> inf) n / log(n)
= lim (n -> inf) 1 / (1 / n) (L'Hopital's Rule)
= inf
This proves that n^2 is the "larger" function, and so O(n^2 + nlog(n)) = n^2
Note that you also could have shown that:
lim (n -> inf) nlog(n) / n^2 = 0