Data Str &amp; Algorithm HW Solutions 18

# Data Str &amp; Algorithm HW Solutions 18 - 18 Chap 3...

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

18 Chap. 3 Algorithm Analysis 3.8 Other values for n 0 and c are possible than what is given here. (a) The upper bound is O( n ) for n 0 > 0 and c = c 1 . The lower bound is Ω( n ) for n 0 > 0 and c = c 1 . (b) The upper bound is O( n 3 ) for n 0 >c 3 and c = c 2 +1 . The lower bound is Ω( n 3 ) for n 0 >c 3 and c = c 2 . (c) The upper bound is O( n log n ) for n 0 >c 5 and c = c 4 +1 . The lower bound is Ω( n log n ) for n 0 >c 5 and c = c 4 . (d) The upper bound is O(2 n ) for n 0 >c 7 100 and c = c 6 +1 .T h e lower bound is Ω(2 n ) for n 0 >c 7 100 and c = c 6 . (100 is used for convenience to insure that 2 n >n 6 ) 3.9 (a) f ( n )=Θ( g ( n )) since log n 2 = 2log n . (b) f ( n ) is in Ω( g ( n )) since n c grows faster than log n c for any c . (c) f ( n ) is in Ω( g ( n )) . Dividing both sides by log n , we see that log n grows faster than 1 . (d) f ( n ) is in Ω( g ( n )) . If we take both f ( n ) and g ( n ) as exponents for 2, we get 2 n on one side and 2 log 2 n =(2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Ask a homework question - tutors are online