Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

MT1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Massachusetts Institute of Technology Handout 12

6.046J/18.410J: Introduction to Algorithms February 26, 2002


Professors Michel Goemans and Piotr Indyk

Master Theorem Worksheet Solutions


This is a worksheet to help you master solving recurrence relations using the Master Theorem.
For each recurrence, either give the asympotic solution using the Master Theorem (state
which case), or else state that the Master Theorem doesn’t apply. You should be able to go
through these 25 recurrences in 10 minutes.

Problem 1-1. T (n) = 3T (n/2) + n2


T (n) = Θ(n2 ) (case 3).

Problem 1-2. T (n) = 7T (n/2) + n2


T (n) = Θ(nlg 7 ) (case 1).

Problem 1-3. T (n) = 4T (n/2) + n2


T (n) = Θ(n2 lg n) (case 2).

Problem 1-4. T (n) = 3T (n/4) + n lg n


T (n) = Θ(n lg n) (case 3).

Problem 1-5. T (n) = 4T (n/2) + lg n


T (n) = Θ(n2 ) (case 1).

Problem 1-6. T (n) = T (n − 1) + n


M.T. doesn’t apply. Iteration gives T (n) = Θ(n2 ).

Problem 1-7. T (n) = 4T (n/2) + n2 lg n


T (n) = Θ(n2 lg2 n) (extended case 2).

Problem 1-8. T (n) = 5T (n/2) + n2 lg n


T (n) = Θ(nlg 5 ) (case 1).
2 Handout 12: Master Theorem Worksheet Solutions

Problem 1-9. T (n) = 3T (n/3) + n/ lg n


M.T. case 1 doesn’t apply since f (n) = n/ lg n is not polynomially smaller than nlog3 3−ε for
any ε > 0.

Problem 1-10. T (n) = 2T (n/4) + c


T (n) = Θ(n1/2 ) (case 1).

Problem 1-11. T (n) = T (n/4) + lg n


T (n) = Θ(lg2 n) (extended case 2).

Problem 1-12. T (n) = T (n/2) + T (n/4) + n2


M.T. doesn’t apply. Recursion tree gives guess T (n) = Θ(n2 ).

Problem 1-13. T (n) = 2T (n/4) + lg n


T (n) = Θ(n1/2 ) (case 1).

Problem 1-14. T (n) = 3T (n/3) + n lg n


T (n) = Θ(n lg2 n) (extended case 2).


Problem 1-15. T (n) = 8T ((n − n)/4) + n2 √
M.T. doesn’t apply. Using Akra-Bazzi can ignore n/4, which
√ gives Θ(n2 ). Could also use
2
M.T. to get an upper bound√of O(n ) by removing the n/4 term and a lower bound of
Ω(n2 ) by replacing the (n − n)/4 term by 0.24n.


Problem 1-16. T (n) = 2T (n/4) + n
T (n) = Θ(n1/2 lg n) (case 2).

Problem 1-17. T (n) = 2T (n/4) + n0.51


T (n) = Θ(n0.51 ) (case 3).

Problem 1-18. T (n) = 16T (n/4) + n!


T (n) = Θ(n!) (case 3).
Handout 12: Master Theorem Worksheet Solutions 3

Problem 1-19. T (n) = 3T (n/2) + n


T (n) = Θ(nlg 3 ) (case 1).

Problem 1-20. T (n) = 4T (n/2) + cn


T (n) = Θ(n2 ) (case 1).

Problem 1-21. T (n) = 3T (n/3) + n/2


T (n) = Θ(n lg n) (case 2).

Problem 1-22. T (n) = 4T (n/2) + n/ lg n


T (n) = Θ(n2 ) (case 1).

Problem 1-23. T (n) = 7T (n/3) + n2


T (n) = Θ(n2 ) (case 3).

Problem 1-24. T (n) = 8T (n/3) + 2n


T (n) = Θ(2n ) (case 3).

Problem 1-25. T (n) = 16T (n/4) + n


T (n) = Θ(n2 ) (case 1).

You might also like