SlideShare a Scribd company logo
1 of 3
Download to read offline
CSG713 Advanced Algorithms                                                           Simplified Master Method
Fall 2004                                                                                  September 15, 2004



        The Simplified Master Method for Solving Recurrences
Consider recurrences of the form
                                                T (n) = aT (n/b) + nc
for constants a ≥ 1, b > 1, and c ≥ 0. Recurrences of this form include mergesort,

                                                T (n) = 2T (n/2) + n,

Strassen’s algorithm for matrix multiplication,

                                                T (n) = 7T (n/2) + n2 ,

binary search,
                                                 T (n) = T (n/2) + 1,
and so on.
   We can solve the general form of this recurrence via iteration. Rewriting the recurrence with the recursive
component last and using a generic parameter not to be confused with n, we obtain:

                                                T (2) = 2c + aT (2/b)                                      (1)

    Since our pattern (Equation 1) is valid for any value of 2, we may use it to “iterate” the recurrence as
follows.


                      T (n)   = nc + aT (n/b)
                              = nc + a (n/b)c + a T (n/b2 )
                              = nc + a(n/b)c + a2 T (n/b2 )
                              = nc + a(n/b)c + a2 (n/b2 )c + a T (n/b3 )
                              = nc + a(n/b)c + a2 (n/b2 )c + a3 T (n/b3 )
                              = nc + a(n/b)c + a2 (n/b2 )c + a3 (n/b3 )c + a T (n/b4 )
                              = nc + a(n/b)c + a2 (n/b2 )c + a3 (n/b3 )c + a4 T (n/b4 )

   Pulling out the nc term common in each of the first four factors, we may simplify this expression and
obtain a pattern as follows.


                       T (n) = nc + nc (a/bc ) + nc (a/bc )2 + nc (a/bc )3 + a4 T (n/b4 )
                             .
                             .
                             .
                                     k−1             j
                                            a
                              = nc                       + ak T (n/bk )
                                     j=0
                                            bc

   We will next show that the pattern we have established is correct, by induction.
                                    k−1          j
                                           a
Claim 1 For all k ≥ 1, T (n) = nc                    + ak T (n/bk ).
                                    j=0
                                           bc


                                                               1
Proof: The proof is by induction on k. The base case, k = 1, is trivially true since the resulting equation
matches the original recurrence. For the inductive step, assume that the statement is true for k = i − 1; i.e.,
                                                          i−2             j
                                                                    a
                                         T (n) = nc                           + ai−1 T (n/bi−1 ).
                                                          j=0
                                                                    bc

Our task is then to show that the statement is true for k = i; i.e.,
                                                               i−1            j
                                                                         a
                                           T (n) = nc                             + ai T (n/bi ).
                                                               j=0
                                                                         bc

This may be accomplished by starting with the inductive hypothesis and applying the definition of the
recurrence, as follows.
                                                i−2             j
                                                          a
                          T (n) = nc                                + ai−1 T (n/bi−1 )
                                                j=0
                                                          bc
                                                i−2             j
                                                          a
                                     = nc                           + ai−1 (n/bi−1 )c + a T (n/bi )
                                                j=0
                                                          bc
                                                i−2             j                       i−1
                                                          a                    a
                                     = nc                           + nc                      + ai T (n/bi )
                                                j=0
                                                          bc                   bc
                                                i−1             j
                                                          a
                                     = nc                           + ai T (n/bi )
                                                j=0
                                                          bc

                                                                                                                   2

                                       a  k−1         j
   We thus have that T (n) = nc j=0 bc + ak T (n/bk ) for all k ≥ 1. We next choose a value of k which
causes our recurrence to reach a known base case. Since n/bk = 1 when k = logb n, and T (1) = Θ(1), we
have
                                                           logb n−1
                                                                              a     j
                                     T (n) = nc                                         + alogb n T (1)
                                                                j=0
                                                                              bc
                                                           logb n−1
                                                                              a     j
                                                = nc                                    + nlogb a Θ(1)
                                                                j=0
                                                                              bc
                                                           logb n−1
                                                                              a     j
                                                = nc                                    + Θ(nlogb a )
                                                                j=0
                                                                              bc

                                                                     a                    log n−1         j
The solution to our recurrence involves the geometric series j=0
                                                               b
                                                                    bc . In order to bound this series,
                                    c       c             c
we must consider three cases: a/b > 1, a/b = 1, and a/b < 1. This is equivalent to considering the cases
c < logb a, c = logb a, and c > logb a.

Case 1: c < logb a ⇔ a/bc > 1.
   If a/bc > 1, we then have
                     logb n−1
                                a    j       (a/bc )logb n − 1                       nlogb a
                                         =                     = Θ (a/bc )logb n = Θ                           .
                       j=0
                                bc             (a/bc ) − 1                             nc


                                                                         2
From this we may concude that
                                                           logb n−1
                                                                              a       j
                                  T (n) = nc                                              + Θ(nlogb a )
                                                                j=0
                                                                              bc
                                                                    nlogb a
                                            = nc · Θ                                      + Θ(nlogb a )
                                                                      nc
                                            =         Θ(nlogb a ).

Case 2: c = logb a ⇔ a/bc = 1.
   If a/bc = 1, we then have
                                       logb n−1                     logb n−1
                                                      a     j
                                                                =                     1j = logb n.
                                          j=0
                                                      bc                  j=0
Noting that c = logb a, we may then conclude that
                                                           logb n−1
                                                                              a       j
                                  T (n) = nc                                              + Θ(nlogb a )
                                                                j=0
                                                                              bc

                                            = n · logb n + Θ(nlogb a )
                                                       c

                                            = Θ(nc log n) = Θ(nlogb a log n)

Case 3: c > logb a ⇔ a/bc < 1.
   If a/bc < 1, we then have
                                       logb n−1
                                                      a     j
                                                                ≥ (a/bc )0 = 1 = Ω(1)
                                          j=0
                                                      bc
and
                               logb n−1                     ∞
                                           a      j                 a         j          1
                                                      ≤                           =            = O(1)
                                 j=0
                                           bc              j=0
                                                                    bc                1 − a/bc
which yields
                                                logb n−1
                                                                  a       j
                                                                              = Θ(1).
                                                      j=0
                                                                  bc
Noting that c > logb a, we may then conclude that
                                                           logb n−1
                                                                              a       j
                                  T (n) = nc                                              + Θ(nlogb a )
                                                                j=0
                                                                              bc

                                            = n · Θ(1) + Θ(nlogb a )
                                                       c

                                            = Θ(nc )

    Note that in each case, either c or logb a appears in the exponent of the solution, and it is the larger
of these two values which appears. If these terms are equal, then an extra log factor appears as well. In
summary, we have

                       Case 1:     c < logb a              T (n) = Θ(nlogb a )
                       Case 2:     c = logb a              T (n) = Θ(nc log n) = Θ(nlogb a log n)
                       Case 3:     c > logb a              T (n) = Θ(nc )



                                                                      3

More Related Content

What's hot

Lesson 14: Exponential Growth and Decay
Lesson 14: Exponential Growth and DecayLesson 14: Exponential Growth and Decay
Lesson 14: Exponential Growth and DecayMatthew Leingang
 
Supplement to local voatility
Supplement to local voatilitySupplement to local voatility
Supplement to local voatilityIlya Gikhman
 
fauvel_igarss.pdf
fauvel_igarss.pdffauvel_igarss.pdf
fauvel_igarss.pdfgrssieee
 
B. Sazdovic - Noncommutativity and T-duality
B. Sazdovic - Noncommutativity and T-dualityB. Sazdovic - Noncommutativity and T-duality
B. Sazdovic - Noncommutativity and T-dualitySEENET-MTP
 
Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)IJERD Editor
 
Weak Isotropic three-wave turbulence, Fondation des Treilles, July 16 2010
Weak Isotropic three-wave turbulence, Fondation des Treilles, July 16 2010Weak Isotropic three-wave turbulence, Fondation des Treilles, July 16 2010
Weak Isotropic three-wave turbulence, Fondation des Treilles, July 16 2010Colm Connaughton
 
Analisis Korespondensi
Analisis KorespondensiAnalisis Korespondensi
Analisis Korespondensidessybudiyanti
 
Bayesian case studies, practical 2
Bayesian case studies, practical 2Bayesian case studies, practical 2
Bayesian case studies, practical 2Robin Ryder
 
R. Jimenez - Fundamental Physics from Astronomical Observations
R. Jimenez - Fundamental Physics from Astronomical ObservationsR. Jimenez - Fundamental Physics from Astronomical Observations
R. Jimenez - Fundamental Physics from Astronomical ObservationsSEENET-MTP
 
Lesson 15: Exponential Growth and Decay (Section 041 slides)
Lesson 15: Exponential Growth and Decay (Section 041 slides)Lesson 15: Exponential Growth and Decay (Section 041 slides)
Lesson 15: Exponential Growth and Decay (Section 041 slides)Matthew Leingang
 
Multicurrency project
Multicurrency projectMulticurrency project
Multicurrency projectIlya Gikhman
 
The Probability that a Matrix of Integers Is Diagonalizable
The Probability that a Matrix of Integers Is DiagonalizableThe Probability that a Matrix of Integers Is Diagonalizable
The Probability that a Matrix of Integers Is DiagonalizableJay Liew
 
12X1 T08 05 binomial coefficients (2010)
12X1 T08 05 binomial coefficients (2010)12X1 T08 05 binomial coefficients (2010)
12X1 T08 05 binomial coefficients (2010)Nigel Simmons
 
12X1 T08 05 binomial coefficients
12X1 T08 05 binomial coefficients12X1 T08 05 binomial coefficients
12X1 T08 05 binomial coefficientsNigel Simmons
 

What's hot (17)

Lesson 14: Exponential Growth and Decay
Lesson 14: Exponential Growth and DecayLesson 14: Exponential Growth and Decay
Lesson 14: Exponential Growth and Decay
 
Supplement to local voatility
Supplement to local voatilitySupplement to local voatility
Supplement to local voatility
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
fauvel_igarss.pdf
fauvel_igarss.pdffauvel_igarss.pdf
fauvel_igarss.pdf
 
B. Sazdovic - Noncommutativity and T-duality
B. Sazdovic - Noncommutativity and T-dualityB. Sazdovic - Noncommutativity and T-duality
B. Sazdovic - Noncommutativity and T-duality
 
Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)
 
Weak Isotropic three-wave turbulence, Fondation des Treilles, July 16 2010
Weak Isotropic three-wave turbulence, Fondation des Treilles, July 16 2010Weak Isotropic three-wave turbulence, Fondation des Treilles, July 16 2010
Weak Isotropic three-wave turbulence, Fondation des Treilles, July 16 2010
 
Analisis Korespondensi
Analisis KorespondensiAnalisis Korespondensi
Analisis Korespondensi
 
Bayesian case studies, practical 2
Bayesian case studies, practical 2Bayesian case studies, practical 2
Bayesian case studies, practical 2
 
R. Jimenez - Fundamental Physics from Astronomical Observations
R. Jimenez - Fundamental Physics from Astronomical ObservationsR. Jimenez - Fundamental Physics from Astronomical Observations
R. Jimenez - Fundamental Physics from Astronomical Observations
 
CME Deliverable Interest Rate Swap Future
CME Deliverable Interest Rate Swap FutureCME Deliverable Interest Rate Swap Future
CME Deliverable Interest Rate Swap Future
 
Lesson 15: Exponential Growth and Decay (Section 041 slides)
Lesson 15: Exponential Growth and Decay (Section 041 slides)Lesson 15: Exponential Growth and Decay (Section 041 slides)
Lesson 15: Exponential Growth and Decay (Section 041 slides)
 
Multicurrency project
Multicurrency projectMulticurrency project
Multicurrency project
 
The Probability that a Matrix of Integers Is Diagonalizable
The Probability that a Matrix of Integers Is DiagonalizableThe Probability that a Matrix of Integers Is Diagonalizable
The Probability that a Matrix of Integers Is Diagonalizable
 
12X1 T08 05 binomial coefficients (2010)
12X1 T08 05 binomial coefficients (2010)12X1 T08 05 binomial coefficients (2010)
12X1 T08 05 binomial coefficients (2010)
 
12X1 T08 05 binomial coefficients
12X1 T08 05 binomial coefficients12X1 T08 05 binomial coefficients
12X1 T08 05 binomial coefficients
 
SSA slides
SSA slidesSSA slides
SSA slides
 

Viewers also liked

FORECASTING OF RENEWABLE ENERGY PRODUCTION BY USING GENETIC ALGORITHM (GA) FO...
FORECASTING OF RENEWABLE ENERGY PRODUCTION BY USING GENETIC ALGORITHM (GA) FO...FORECASTING OF RENEWABLE ENERGY PRODUCTION BY USING GENETIC ALGORITHM (GA) FO...
FORECASTING OF RENEWABLE ENERGY PRODUCTION BY USING GENETIC ALGORITHM (GA) FO...u772020
 
Clonal Selection Algorithm Parallelization with MPJExpress
Clonal Selection Algorithm Parallelization with MPJExpressClonal Selection Algorithm Parallelization with MPJExpress
Clonal Selection Algorithm Parallelization with MPJExpressAyi Purbasari
 
Recurrence relationclass 5
Recurrence relationclass 5Recurrence relationclass 5
Recurrence relationclass 5Kumar
 
Radial Thickness Calculation and Visualization for Volumetric Layers-8397
Radial Thickness Calculation and Visualization for Volumetric Layers-8397Radial Thickness Calculation and Visualization for Volumetric Layers-8397
Radial Thickness Calculation and Visualization for Volumetric Layers-8397Kitware Kitware
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithmsGanesh Solanke
 

Viewers also liked (7)

FORECASTING OF RENEWABLE ENERGY PRODUCTION BY USING GENETIC ALGORITHM (GA) FO...
FORECASTING OF RENEWABLE ENERGY PRODUCTION BY USING GENETIC ALGORITHM (GA) FO...FORECASTING OF RENEWABLE ENERGY PRODUCTION BY USING GENETIC ALGORITHM (GA) FO...
FORECASTING OF RENEWABLE ENERGY PRODUCTION BY USING GENETIC ALGORITHM (GA) FO...
 
Clonal Selection Algorithm Parallelization with MPJExpress
Clonal Selection Algorithm Parallelization with MPJExpressClonal Selection Algorithm Parallelization with MPJExpress
Clonal Selection Algorithm Parallelization with MPJExpress
 
Recurrence relation
Recurrence relationRecurrence relation
Recurrence relation
 
Recurrence relationclass 5
Recurrence relationclass 5Recurrence relationclass 5
Recurrence relationclass 5
 
Radial Thickness Calculation and Visualization for Volumetric Layers-8397
Radial Thickness Calculation and Visualization for Volumetric Layers-8397Radial Thickness Calculation and Visualization for Volumetric Layers-8397
Radial Thickness Calculation and Visualization for Volumetric Layers-8397
 
Os Question Bank
Os Question BankOs Question Bank
Os Question Bank
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
 

Similar to Master method

Correlative level coding
Correlative level codingCorrelative level coding
Correlative level codingsrkrishna341
 
Dsp U Lec10 DFT And FFT
Dsp U   Lec10  DFT And  FFTDsp U   Lec10  DFT And  FFT
Dsp U Lec10 DFT And FFTtaha25
 
Recurrences
RecurrencesRecurrences
RecurrencesDEVTYPE
 
Roots of unity_cool_app
Roots of unity_cool_appRoots of unity_cool_app
Roots of unity_cool_appdineshkrithi
 
Chapter 9 computation of the dft
Chapter 9 computation of the dftChapter 9 computation of the dft
Chapter 9 computation of the dftmikeproud
 
Fission rate and_time_of_higly_excited_nuclei
Fission rate and_time_of_higly_excited_nucleiFission rate and_time_of_higly_excited_nuclei
Fission rate and_time_of_higly_excited_nucleiYuri Anischenko
 
Formulario de matematicas
Formulario de matematicasFormulario de matematicas
Formulario de matematicasCarlos
 
Remodulization of Congruences
Remodulization of CongruencesRemodulization of Congruences
Remodulization of CongruencesJeffrey Gold
 
T2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxT2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxGadaFarhan
 
torsionbinormalnotes
torsionbinormalnotestorsionbinormalnotes
torsionbinormalnotesJeremy Lane
 
CS330-Lectures Statistics And Probability
CS330-Lectures Statistics And ProbabilityCS330-Lectures Statistics And Probability
CS330-Lectures Statistics And Probabilitybryan111472
 

Similar to Master method (20)

Correlative level coding
Correlative level codingCorrelative level coding
Correlative level coding
 
Dsp U Lec10 DFT And FFT
Dsp U   Lec10  DFT And  FFTDsp U   Lec10  DFT And  FFT
Dsp U Lec10 DFT And FFT
 
Solved problems
Solved problemsSolved problems
Solved problems
 
Recurrences
RecurrencesRecurrences
Recurrences
 
3.pdf
3.pdf3.pdf
3.pdf
 
Roots of unity_cool_app
Roots of unity_cool_appRoots of unity_cool_app
Roots of unity_cool_app
 
Chapter 9 computation of the dft
Chapter 9 computation of the dftChapter 9 computation of the dft
Chapter 9 computation of the dft
 
Fission rate and_time_of_higly_excited_nuclei
Fission rate and_time_of_higly_excited_nucleiFission rate and_time_of_higly_excited_nuclei
Fission rate and_time_of_higly_excited_nuclei
 
Cheat Sheet
Cheat SheetCheat Sheet
Cheat Sheet
 
Formulario de matematicas
Formulario de matematicasFormulario de matematicas
Formulario de matematicas
 
Signals Processing Homework Help
Signals Processing Homework HelpSignals Processing Homework Help
Signals Processing Homework Help
 
Future CMB Experiments
Future CMB ExperimentsFuture CMB Experiments
Future CMB Experiments
 
Computer science-formulas
Computer science-formulasComputer science-formulas
Computer science-formulas
 
B spline
B splineB spline
B spline
 
Time complexity
Time complexityTime complexity
Time complexity
 
Remodulization of Congruences
Remodulization of CongruencesRemodulization of Congruences
Remodulization of Congruences
 
Final
Final Final
Final
 
T2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxT2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptx
 
torsionbinormalnotes
torsionbinormalnotestorsionbinormalnotes
torsionbinormalnotes
 
CS330-Lectures Statistics And Probability
CS330-Lectures Statistics And ProbabilityCS330-Lectures Statistics And Probability
CS330-Lectures Statistics And Probability
 

Recently uploaded

Vashikaran Specialist in London Black Magic Removal No 1 Astrologer in UK
Vashikaran Specialist in London Black Magic Removal No 1 Astrologer in UKVashikaran Specialist in London Black Magic Removal No 1 Astrologer in UK
Vashikaran Specialist in London Black Magic Removal No 1 Astrologer in UKAmil Baba Naveed Bangali
 
(NISHA) Call Girls Sanath Nagar ✔️Just Call 7001035870✔️ HI-Fi Hyderabad Esco...
(NISHA) Call Girls Sanath Nagar ✔️Just Call 7001035870✔️ HI-Fi Hyderabad Esco...(NISHA) Call Girls Sanath Nagar ✔️Just Call 7001035870✔️ HI-Fi Hyderabad Esco...
(NISHA) Call Girls Sanath Nagar ✔️Just Call 7001035870✔️ HI-Fi Hyderabad Esco...Sanjna Singh
 
Codex Singularity: Search for the Prisca Sapientia
Codex Singularity: Search for the Prisca SapientiaCodex Singularity: Search for the Prisca Sapientia
Codex Singularity: Search for the Prisca Sapientiajfrenchau
 
CALL ON ➥8923113531 🔝Call Girls Indira Nagar Lucknow Lucknow best Night Fun s...
CALL ON ➥8923113531 🔝Call Girls Indira Nagar Lucknow Lucknow best Night Fun s...CALL ON ➥8923113531 🔝Call Girls Indira Nagar Lucknow Lucknow best Night Fun s...
CALL ON ➥8923113531 🔝Call Girls Indira Nagar Lucknow Lucknow best Night Fun s...anilsa9823
 
Lucknow 💋 Call Girls Lucknow - Book 8923113531 Call Girls Available 24 Hours ...
Lucknow 💋 Call Girls Lucknow - Book 8923113531 Call Girls Available 24 Hours ...Lucknow 💋 Call Girls Lucknow - Book 8923113531 Call Girls Available 24 Hours ...
Lucknow 💋 Call Girls Lucknow - Book 8923113531 Call Girls Available 24 Hours ...anilsa9823
 
Top No 1 Amil baba in Islamabad Famous Amil baba in Pakistan Amil baba Contac...
Top No 1 Amil baba in Islamabad Famous Amil baba in Pakistan Amil baba Contac...Top No 1 Amil baba in Islamabad Famous Amil baba in Pakistan Amil baba Contac...
Top No 1 Amil baba in Islamabad Famous Amil baba in Pakistan Amil baba Contac...Amil Baba Naveed Bangali
 
Deerfoot Church of Christ Bulletin 4 28 24
Deerfoot Church of Christ Bulletin 4 28 24Deerfoot Church of Christ Bulletin 4 28 24
Deerfoot Church of Christ Bulletin 4 28 24deerfootcoc
 
Genesis 1:10 || Meditate the Scripture daily verse by verse
Genesis 1:10  ||  Meditate the Scripture daily verse by verseGenesis 1:10  ||  Meditate the Scripture daily verse by verse
Genesis 1:10 || Meditate the Scripture daily verse by versemaricelcanoynuay
 
Lucknow 💋 (Call Girls) in Lucknow | Book 8923113531 Extreme Naughty Call Girl...
Lucknow 💋 (Call Girls) in Lucknow | Book 8923113531 Extreme Naughty Call Girl...Lucknow 💋 (Call Girls) in Lucknow | Book 8923113531 Extreme Naughty Call Girl...
Lucknow 💋 (Call Girls) in Lucknow | Book 8923113531 Extreme Naughty Call Girl...anilsa9823
 
CALL ON ➥8923113531 🔝Call Girls Singar Nagar Lucknow best Night Fun service 👔
CALL ON ➥8923113531 🔝Call Girls Singar Nagar Lucknow best Night Fun service  👔CALL ON ➥8923113531 🔝Call Girls Singar Nagar Lucknow best Night Fun service  👔
CALL ON ➥8923113531 🔝Call Girls Singar Nagar Lucknow best Night Fun service 👔anilsa9823
 
Elite Class ➥8448380779▻ Call Girls In Mehrauli Gurgaon Road Delhi NCR
Elite Class ➥8448380779▻ Call Girls In Mehrauli Gurgaon Road Delhi NCRElite Class ➥8448380779▻ Call Girls In Mehrauli Gurgaon Road Delhi NCR
Elite Class ➥8448380779▻ Call Girls In Mehrauli Gurgaon Road Delhi NCRDelhi Call girls
 
Genesis 1:8 || Meditate the Scripture daily verse by verse
Genesis 1:8  ||  Meditate the Scripture daily verse by verseGenesis 1:8  ||  Meditate the Scripture daily verse by verse
Genesis 1:8 || Meditate the Scripture daily verse by versemaricelcanoynuay
 
Call Girls in sarojini nagar Delhi 8264348440 ✅ call girls ❤️
Call Girls in sarojini nagar Delhi 8264348440 ✅ call girls ❤️Call Girls in sarojini nagar Delhi 8264348440 ✅ call girls ❤️
Call Girls in sarojini nagar Delhi 8264348440 ✅ call girls ❤️soniya singh
 
Surah Yasin and Daily Spiritual Practices
Surah Yasin and Daily Spiritual PracticesSurah Yasin and Daily Spiritual Practices
Surah Yasin and Daily Spiritual Practicesaijazuddin14
 
Authentic Black magic, Kala ilam expert in UAE and Kala ilam specialist in S...
Authentic Black magic, Kala ilam expert in UAE  and Kala ilam specialist in S...Authentic Black magic, Kala ilam expert in UAE  and Kala ilam specialist in S...
Authentic Black magic, Kala ilam expert in UAE and Kala ilam specialist in S...baharayali
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiAmil Baba Mangal Maseeh
 
No 1 Amil baba in UK Best Astrologer in UK Famous Vashikaran Specialist in UK
No 1 Amil baba in UK Best Astrologer in UK Famous Vashikaran Specialist in UKNo 1 Amil baba in UK Best Astrologer in UK Famous Vashikaran Specialist in UK
No 1 Amil baba in UK Best Astrologer in UK Famous Vashikaran Specialist in UKAmil Baba Naveed Bangali
 
St John's Church Parish Diary for May 2024
St John's Church Parish Diary for May 2024St John's Church Parish Diary for May 2024
St John's Church Parish Diary for May 2024Chris Lyne
 
Lucknow 💋 best call girls in Lucknow ₹7.5k Pick Up & Drop With Cash Payment 8...
Lucknow 💋 best call girls in Lucknow ₹7.5k Pick Up & Drop With Cash Payment 8...Lucknow 💋 best call girls in Lucknow ₹7.5k Pick Up & Drop With Cash Payment 8...
Lucknow 💋 best call girls in Lucknow ₹7.5k Pick Up & Drop With Cash Payment 8...anilsa9823
 
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best Female service 🕶
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best Female service  🕶CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best Female service  🕶
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best Female service 🕶anilsa9823
 

Recently uploaded (20)

Vashikaran Specialist in London Black Magic Removal No 1 Astrologer in UK
Vashikaran Specialist in London Black Magic Removal No 1 Astrologer in UKVashikaran Specialist in London Black Magic Removal No 1 Astrologer in UK
Vashikaran Specialist in London Black Magic Removal No 1 Astrologer in UK
 
(NISHA) Call Girls Sanath Nagar ✔️Just Call 7001035870✔️ HI-Fi Hyderabad Esco...
(NISHA) Call Girls Sanath Nagar ✔️Just Call 7001035870✔️ HI-Fi Hyderabad Esco...(NISHA) Call Girls Sanath Nagar ✔️Just Call 7001035870✔️ HI-Fi Hyderabad Esco...
(NISHA) Call Girls Sanath Nagar ✔️Just Call 7001035870✔️ HI-Fi Hyderabad Esco...
 
Codex Singularity: Search for the Prisca Sapientia
Codex Singularity: Search for the Prisca SapientiaCodex Singularity: Search for the Prisca Sapientia
Codex Singularity: Search for the Prisca Sapientia
 
CALL ON ➥8923113531 🔝Call Girls Indira Nagar Lucknow Lucknow best Night Fun s...
CALL ON ➥8923113531 🔝Call Girls Indira Nagar Lucknow Lucknow best Night Fun s...CALL ON ➥8923113531 🔝Call Girls Indira Nagar Lucknow Lucknow best Night Fun s...
CALL ON ➥8923113531 🔝Call Girls Indira Nagar Lucknow Lucknow best Night Fun s...
 
Lucknow 💋 Call Girls Lucknow - Book 8923113531 Call Girls Available 24 Hours ...
Lucknow 💋 Call Girls Lucknow - Book 8923113531 Call Girls Available 24 Hours ...Lucknow 💋 Call Girls Lucknow - Book 8923113531 Call Girls Available 24 Hours ...
Lucknow 💋 Call Girls Lucknow - Book 8923113531 Call Girls Available 24 Hours ...
 
Top No 1 Amil baba in Islamabad Famous Amil baba in Pakistan Amil baba Contac...
Top No 1 Amil baba in Islamabad Famous Amil baba in Pakistan Amil baba Contac...Top No 1 Amil baba in Islamabad Famous Amil baba in Pakistan Amil baba Contac...
Top No 1 Amil baba in Islamabad Famous Amil baba in Pakistan Amil baba Contac...
 
Deerfoot Church of Christ Bulletin 4 28 24
Deerfoot Church of Christ Bulletin 4 28 24Deerfoot Church of Christ Bulletin 4 28 24
Deerfoot Church of Christ Bulletin 4 28 24
 
Genesis 1:10 || Meditate the Scripture daily verse by verse
Genesis 1:10  ||  Meditate the Scripture daily verse by verseGenesis 1:10  ||  Meditate the Scripture daily verse by verse
Genesis 1:10 || Meditate the Scripture daily verse by verse
 
Lucknow 💋 (Call Girls) in Lucknow | Book 8923113531 Extreme Naughty Call Girl...
Lucknow 💋 (Call Girls) in Lucknow | Book 8923113531 Extreme Naughty Call Girl...Lucknow 💋 (Call Girls) in Lucknow | Book 8923113531 Extreme Naughty Call Girl...
Lucknow 💋 (Call Girls) in Lucknow | Book 8923113531 Extreme Naughty Call Girl...
 
CALL ON ➥8923113531 🔝Call Girls Singar Nagar Lucknow best Night Fun service 👔
CALL ON ➥8923113531 🔝Call Girls Singar Nagar Lucknow best Night Fun service  👔CALL ON ➥8923113531 🔝Call Girls Singar Nagar Lucknow best Night Fun service  👔
CALL ON ➥8923113531 🔝Call Girls Singar Nagar Lucknow best Night Fun service 👔
 
Elite Class ➥8448380779▻ Call Girls In Mehrauli Gurgaon Road Delhi NCR
Elite Class ➥8448380779▻ Call Girls In Mehrauli Gurgaon Road Delhi NCRElite Class ➥8448380779▻ Call Girls In Mehrauli Gurgaon Road Delhi NCR
Elite Class ➥8448380779▻ Call Girls In Mehrauli Gurgaon Road Delhi NCR
 
Genesis 1:8 || Meditate the Scripture daily verse by verse
Genesis 1:8  ||  Meditate the Scripture daily verse by verseGenesis 1:8  ||  Meditate the Scripture daily verse by verse
Genesis 1:8 || Meditate the Scripture daily verse by verse
 
Call Girls in sarojini nagar Delhi 8264348440 ✅ call girls ❤️
Call Girls in sarojini nagar Delhi 8264348440 ✅ call girls ❤️Call Girls in sarojini nagar Delhi 8264348440 ✅ call girls ❤️
Call Girls in sarojini nagar Delhi 8264348440 ✅ call girls ❤️
 
Surah Yasin and Daily Spiritual Practices
Surah Yasin and Daily Spiritual PracticesSurah Yasin and Daily Spiritual Practices
Surah Yasin and Daily Spiritual Practices
 
Authentic Black magic, Kala ilam expert in UAE and Kala ilam specialist in S...
Authentic Black magic, Kala ilam expert in UAE  and Kala ilam specialist in S...Authentic Black magic, Kala ilam expert in UAE  and Kala ilam specialist in S...
Authentic Black magic, Kala ilam expert in UAE and Kala ilam specialist in S...
 
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in KarachiNo.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Karachi
 
No 1 Amil baba in UK Best Astrologer in UK Famous Vashikaran Specialist in UK
No 1 Amil baba in UK Best Astrologer in UK Famous Vashikaran Specialist in UKNo 1 Amil baba in UK Best Astrologer in UK Famous Vashikaran Specialist in UK
No 1 Amil baba in UK Best Astrologer in UK Famous Vashikaran Specialist in UK
 
St John's Church Parish Diary for May 2024
St John's Church Parish Diary for May 2024St John's Church Parish Diary for May 2024
St John's Church Parish Diary for May 2024
 
Lucknow 💋 best call girls in Lucknow ₹7.5k Pick Up & Drop With Cash Payment 8...
Lucknow 💋 best call girls in Lucknow ₹7.5k Pick Up & Drop With Cash Payment 8...Lucknow 💋 best call girls in Lucknow ₹7.5k Pick Up & Drop With Cash Payment 8...
Lucknow 💋 best call girls in Lucknow ₹7.5k Pick Up & Drop With Cash Payment 8...
 
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best Female service 🕶
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best Female service  🕶CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best Female service  🕶
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best Female service 🕶
 

Master method

  • 1. CSG713 Advanced Algorithms Simplified Master Method Fall 2004 September 15, 2004 The Simplified Master Method for Solving Recurrences Consider recurrences of the form T (n) = aT (n/b) + nc for constants a ≥ 1, b > 1, and c ≥ 0. Recurrences of this form include mergesort, T (n) = 2T (n/2) + n, Strassen’s algorithm for matrix multiplication, T (n) = 7T (n/2) + n2 , binary search, T (n) = T (n/2) + 1, and so on. We can solve the general form of this recurrence via iteration. Rewriting the recurrence with the recursive component last and using a generic parameter not to be confused with n, we obtain: T (2) = 2c + aT (2/b) (1) Since our pattern (Equation 1) is valid for any value of 2, we may use it to “iterate” the recurrence as follows. T (n) = nc + aT (n/b) = nc + a (n/b)c + a T (n/b2 ) = nc + a(n/b)c + a2 T (n/b2 ) = nc + a(n/b)c + a2 (n/b2 )c + a T (n/b3 ) = nc + a(n/b)c + a2 (n/b2 )c + a3 T (n/b3 ) = nc + a(n/b)c + a2 (n/b2 )c + a3 (n/b3 )c + a T (n/b4 ) = nc + a(n/b)c + a2 (n/b2 )c + a3 (n/b3 )c + a4 T (n/b4 ) Pulling out the nc term common in each of the first four factors, we may simplify this expression and obtain a pattern as follows. T (n) = nc + nc (a/bc ) + nc (a/bc )2 + nc (a/bc )3 + a4 T (n/b4 ) . . . k−1 j a = nc + ak T (n/bk ) j=0 bc We will next show that the pattern we have established is correct, by induction. k−1 j a Claim 1 For all k ≥ 1, T (n) = nc + ak T (n/bk ). j=0 bc 1
  • 2. Proof: The proof is by induction on k. The base case, k = 1, is trivially true since the resulting equation matches the original recurrence. For the inductive step, assume that the statement is true for k = i − 1; i.e., i−2 j a T (n) = nc + ai−1 T (n/bi−1 ). j=0 bc Our task is then to show that the statement is true for k = i; i.e., i−1 j a T (n) = nc + ai T (n/bi ). j=0 bc This may be accomplished by starting with the inductive hypothesis and applying the definition of the recurrence, as follows. i−2 j a T (n) = nc + ai−1 T (n/bi−1 ) j=0 bc i−2 j a = nc + ai−1 (n/bi−1 )c + a T (n/bi ) j=0 bc i−2 j i−1 a a = nc + nc + ai T (n/bi ) j=0 bc bc i−1 j a = nc + ai T (n/bi ) j=0 bc 2 a k−1 j We thus have that T (n) = nc j=0 bc + ak T (n/bk ) for all k ≥ 1. We next choose a value of k which causes our recurrence to reach a known base case. Since n/bk = 1 when k = logb n, and T (1) = Θ(1), we have logb n−1 a j T (n) = nc + alogb n T (1) j=0 bc logb n−1 a j = nc + nlogb a Θ(1) j=0 bc logb n−1 a j = nc + Θ(nlogb a ) j=0 bc a log n−1 j The solution to our recurrence involves the geometric series j=0 b bc . In order to bound this series, c c c we must consider three cases: a/b > 1, a/b = 1, and a/b < 1. This is equivalent to considering the cases c < logb a, c = logb a, and c > logb a. Case 1: c < logb a ⇔ a/bc > 1. If a/bc > 1, we then have logb n−1 a j (a/bc )logb n − 1 nlogb a = = Θ (a/bc )logb n = Θ . j=0 bc (a/bc ) − 1 nc 2
  • 3. From this we may concude that logb n−1 a j T (n) = nc + Θ(nlogb a ) j=0 bc nlogb a = nc · Θ + Θ(nlogb a ) nc = Θ(nlogb a ). Case 2: c = logb a ⇔ a/bc = 1. If a/bc = 1, we then have logb n−1 logb n−1 a j = 1j = logb n. j=0 bc j=0 Noting that c = logb a, we may then conclude that logb n−1 a j T (n) = nc + Θ(nlogb a ) j=0 bc = n · logb n + Θ(nlogb a ) c = Θ(nc log n) = Θ(nlogb a log n) Case 3: c > logb a ⇔ a/bc < 1. If a/bc < 1, we then have logb n−1 a j ≥ (a/bc )0 = 1 = Ω(1) j=0 bc and logb n−1 ∞ a j a j 1 ≤ = = O(1) j=0 bc j=0 bc 1 − a/bc which yields logb n−1 a j = Θ(1). j=0 bc Noting that c > logb a, we may then conclude that logb n−1 a j T (n) = nc + Θ(nlogb a ) j=0 bc = n · Θ(1) + Θ(nlogb a ) c = Θ(nc ) Note that in each case, either c or logb a appears in the exponent of the solution, and it is the larger of these two values which appears. If these terms are equal, then an extra log factor appears as well. In summary, we have Case 1: c < logb a T (n) = Θ(nlogb a ) Case 2: c = logb a T (n) = Θ(nc log n) = Θ(nlogb a log n) Case 3: c > logb a T (n) = Θ(nc ) 3