Reputation: 15
So i got this question in the exam, Find the time complexity of the function
logn+3nlogn-100n^2+50
All logs have base 2
Can anyone tell if the answer is nlogn
or n^2
even though I doubt such a function could even exist for an algorithm.
Upvotes: 0
Views: 43
Reputation: 62
Yes, you are right that such complexity function would never exist since after a certain value of n, your function is always negative(due to -100n^2), which is not possible. Still if someone asks you the complexity of such a function it should be answered to be O(n^2).
Upvotes: 1