{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

MT-F97.sol

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

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

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. For example, 2 n + 2 = O ( n + 2), but 2 2 n + 2 = Θ (4 n ) O (2 n + 2 ). c. True. n 5 lg n = O ( n 6 / lg n ). d. True. Compare the logarithm of each term. The largest term is 2 n lg n = n n . e. True. Both are Θ (1). See chapter 3 of [CLR]. f. True. For a similar recurrence, see pages 59-61 of [CLR]. g. False. It is Θ ( n 2 ). h. True. See your lecture notes or section 10.2 of [CLR]. i. False. It is n - 1. j. False. It is Θ ( n lg n ). 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 f8e5 f8e5 n ). (b) Similar to part (a), but now log b a = d = 3/2. Thus, T ( n ) = Θ ( n d lg n ) = Θ ( n f8e5 f8e5 n lg n ). (c) f ( n ) is not 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 f8e5

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}