I\'ve just been introduced to Big-O notation and I\'ve been given some questions. However I\'m confused as to how to determine the value of n0
.
I have to show that
If you have f(n) = (3n^3 + 20n^2 + 5)
and you want to see if it's O(g(n))
where g(n) = n^3
, I believe you can take the limit of f(n)/g(n)
as n->infinity.
Because the limit is 3, you can see that 3n^3 + 20n^2 + 5
only grows as fast as n^3
. When you have a polynomial like 3n^3 + 20n^2 + 5
, you can tell by inspection that the largest order term will always be the value of O(f(n))
.
It's not a lot of help finding n0 and C, but it's a relatively easy way to determine what the order of something is. As the others have said here, you can just pick n0 and then calculate C.
If you choose n0 = 1, then you have 3*(1^3) + 20*1^2 + 5 = 28
. So if c1^3 <= 28
, c must be 28. You've shown there there is a c and n0 that meets this condition, so you've proved f(n) is O(n^3)