Prove that Thetan On2 notequalto On2Solution4 Ans Prove tha
Prove that Theta(n) + O(n^2) notequalto O(n^2).
Solution
4. Ans) Prove that (n) + O(n2) O(n2)
The two sets are, in fact, equal. You have already shown that (n)+O(n2)O(n2)
(n)+O(n2)O(n2).
To see why O(n2)(n)+O(n2), choose any f O(n2).
Then we know that there exist some constants C,n0 such that for all nn0, we have:
f(n)Cn2=(n)+(Cn2n)
It should be easy to see that n(n) and Cn2n O(n2).
Hence, we have f (n)+O(n2), as desired.
