Question 151: Which of the following is true?
- O(n2) = n
- O(n2) = n3
- O(n2) = n2 log(n)
- All of the above
Solution: The correct answer is option 1. Both n3 and n2 log(n) are asymptotically larger than n2 , since we can’t find any real positive valued of n0 & c to satisfy the following inequality.
O(g(n)) = f(n) : 0 <= f(n) <= c g(n) for all n > n0
