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

Master

 Method  
Proof  (Part  I)  
Design  and  Analysis  
of  Algorithms  I  
The  Master  Method  
•     
Preamble  
Assume  :  recurrence  is  
I.      (  For  some  
constant  c  )  
II.     
And  n  is  a  power  of  b.  
(general    case  is  similar,  but  more  tedious  )  

Idea  :  generalize  MergeSort  analysis.  


   (i.e.,  use  a  recursion  tree  )  
Tim  Roughgarden  
Tem
ver
What  is  the  paJern  ?  Fill  in  the  blanks  in  the  following  
statement:  at  each  level  j  =  0,1,2,…,logbn,  there  are  <blank>  
subproblems,  each  of  size  <blank>  
#  of  Umes  you  can  divide  n  by  b  
before  reaching  1  
The  Recursion  Tree  
a  braches  
       Level  0  

       Level  1  
.  
.  
.   Base  cases  
.   (size  1)  
Level  logbn

Tim  Roughgarden  
Work  at  a  Single  Level  
Total  work  at  level  j  [ignoring  work  in  recursive  calls]  

Tim  Roughgarden  
Total  Work  
Summing  over  all  levels  j  =  0,1,2,…,  logbn  :  

               Total  
               work  

Tim  Roughgarden  

You might also like