MT-F97.sol - COSC3101.03 Solutions to Mid-Term Test 1 a. b....

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
COSC3101.03 Fall 1997-98 Solutions to Mid-Term Test 1 a. True. f ( n ) cg ( n )implies lgf ( n ) lgc + lgg ( n ) ( lgc + 1) lgg ( n ), since lgg ( n ) 1. b. False. Forexample, 2 n + 2= O ( n + 2), but 2 2 n + 2 = Θ (4 n ) O (2 n + 2 ). c. n 5 lg n = O ( n 6 / lg n ). d. Compare the logarithm of each term. The largest term is 2 nlgn = n n . e. Both are Θ (1). See chapter 3 of [CLR]. f. Forasimilar recurrence, see pages 59-61 of [CLR]. g. False. It is Θ ( n 2 ). h. See your lecture notes or section 10.2 of [CLR]. i. False. It is n - 1. j. False. It is Θ ( ). See your lecture notes or section 35.4 of [CLR]. 2 (a) Here the recurrence is of the form T ( n )= aT ( n / b ) ( n d ). Apply the Master Theorem: since log b a =log 4 8=3/2 > d = 1/2, the solution is T ( n Θ ( n log b a Θ ( n √f8e5f8e5 n ). (b) Similar to part (a), but nowlog b a = d =3/2. Thus, T ( n Θ ( n d lg n Θ ( n ). (c) f ( n )isnot a polynomial, so we cannot apply the Master Theorem. Instead, we start with the general solution formula: T ( n Θ ( n log b a [1 + k i = 1 Σ f ( b i )/ a i ]) , where k = log b n = Θ ( lg n ) = Θ ( n n [1 + k i = 1 Σ 8 i / lg 4 i 8 i ]) = Θ ( n n [1 + k i = 1 Σ 1/2 i ]) = Θ ( n n [1 + H k /2] ) = Θ ( n
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/11/2010 for the course CSE CSE 3101 taught by Professor A during the Winter '10 term at York University.

Page1 / 2

MT-F97.sol - COSC3101.03 Solutions to Mid-Term Test 1 a. b....

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online