Big O Notation Solved Examples
Big O Notation Solved Examples
(a)
f(n) = 100n3-
7n3+ 14n2
Solution:
f(n)=93n3+14n2
after removing all constants and
lower order terms
=O(n3)
(b)
f(n) = 100n3- 100n3+
7n2
Solution:
f(n)=100n3- 100n3+7n2
f(n)=7n2
after removing all constants and
lower order terms
=O(n2)
(c)
f(n) = log(7n2)
Solution:
f(n)=log(7n2)
after removing all constants and
lower order terms
=log(n)
(d)
f(n) = 5 log log n + 4 log2 (n)
Solution:
f(n)=5loglogn+4log2(n)
after removing all constants and
lower order terms
=O(log2n)
(e)
f(n) = .001n + 100 · 2n
Solution:
f(n)=.001n+100·2n
after removing all constants and
lower order terms
=O(2n)
(f)
f(n) = n3(1 + 6n + 2014n2)
Solution:
f(n)=n3+6n4+2014n5
after removing all constants and
lower order terms
=O(n5)
(g)
f(n) = (log n)(n + n2)
Solution:
f(n)=nlogn+n2logn
after removing lower order terms
=O(n2log n)
Comments
Post a Comment