h5-sol

# h5-sol - Solutions of Homework 5 Big O Important Note log n...

This preview shows page 1. Sign up to view the full content.

Solutions of Homework 5 : Big O, Ω Important Note : log n n n . Q1. 1. 100 n + 1 100 n + n = 101 n = O ( n ) c = 101 , n 0 = 1. 2. (10 n + 1) 3 (10 n + n ) 3 = (11 n ) 3 = 1331 n 3 = O ( n 3 ) c = 1331 , n 0 = 1. 3. 3 n 3 5 n 2 100 3 n 3 = O ( n 3 ) c = 3 , n 0 = 1. 4. n 2 + n + n + log n n 2 + n 2 + n 2 + n 2 = 4 n 2 = O ( n 2 ) c = 4 , n 0 = 1. Q.2 i. 6 n 2 2 n 6 n 2 = O ( n 2 ) . . . . . . . . . . . . . . . (1) 6 n 2 2 n 6 n 2 2 n 2 = 4 n 2 = Ω( n 2 ) . . . . (2) Form (1) and (2): 6 n 2 2 n log n = Θ( n 2 ). ii. 6 n 2 log 3 n +1 6 n 2 n 3 = O ( n 3 ). iii. 3 n 3 + 44 n 2 n 2 = Ω( n 2 ). Q.3 Proof by contradiction: Assume that (log n ) 2 = O (log n 2 ) (log n ) 2 c log n 2 = k log n (note that log n 2 = 2 log n ) log n k. However, it is impossible to ±nd such a constant k which is always greater than log n for all possible values of n (taking into account that it is a monotonically increasing function). Therefore, (log n ) 2 n = O (log n 2 ). Q.4 Note that: 2 log 2 n = n . 2 3 log 2 n
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Ask a homework question - tutors are online