Quiz #8: O G (N) F (N) O (G) G F (N) N Log (N
Quiz #8: O G (N) F (N) O (G) G F (N) N Log (N
SOLUTIONS
1. { 6 points } Give a big-O estimate for each of these functions. For the function
g(n) in your estimate that f (n) is O(g), use a simple function g of the smallest
order.
n2
(a) f (n) = n log(n4 + 1) + log n
n2 n2
f (n) = O(n log n) + O =O = O(n2 )
log n log n
2n
(b) f (n) = (n log n + n)2 + n!
f (n) = [O(n log n)]2 + O(1) = O n2 (log n)2 = O(n3 )