Data Str & Algorithm HW Solutions 17

Data Str & Algorithm HW Solutions 17 - 3 Algorithm...

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

View Full Document Right Arrow Icon
3 Algorithm Analysis 3.1 Note that n is a positive integer. 5 n log n is most ef f cient for n =1 . 2 n is most ef f cient when 2 n 4 . 10 n is most ef f cient for all n> 5 . 20 n and 2 n are never more ef f cient than the other choices. 3.2 Both log 3 n and log 2 n will have value 0 when n . Otherwise, 2 is the most ef f cient expression for all 1 . 3.3 2 log 3 n log 2 nn 2 / 3 20 n 4 n 2 3 n n ! . 3.4 (a) n +6 inputs (an additive amount, independent of n ). (b) 8 n inputs (a multiplicative factor). (c) 64 n inputs. 3.5 100 n . 10 n . About 4 . 6 n (actually, 3 100 n ). n . 3.6 (a) These questions are quite hard. If f ( n )=2 n = x , then f (2 n 2 n = (2 n ) 2 = x 2 . (b) The answer is 2 ( n log 2 3 ) . Extending from part (a), we need some way to make the growth rate even higher. In particular, we seek some way to
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.
Ask a homework question - tutors are online