Reputation: 23
I want to Express each of the following functions using Big-O notation.
a(n) = 2n + 3n^2 + nlog(n)
b(n) = 5nlog(n) + 10n^3 + n^2
for a(n) I assumed that the answer would be O(n^2) However apparently it is O(n^3) this is the same for b(n) where I assumed the notation would be O(n^3) however it is O(n^4). Is it a rule to round up the power when writing the notation? Why would this be the case? Isn't the notation supposed to take the upper-bound?
Upvotes: 0
Views: 68
Reputation: 4495
You are right, a(n) = O(n2) and b(n) = O(n3).
However, notice that a(n) is also O(n3) and indeed O(n1000). Usually though, we want to express the tightest bound we can find.
Upvotes: 3