SlideShare a Scribd company logo
1 of 10
Improvised Master’s Theorem
Presented By:
Laiba Younas
INTRODUCTION:
• Master’s Theorem is a Popular method for solving the recurrence
relations.
• It is used to compute the complexity of a given divide and conquer
problem in asymptotic time.
• In divide and conquer problem we have three steps:
Divide a large problem into smaller subproblems;
Recursively solve each subproblem, then
Combine solutions of the subproblems to solve the original
problem.
2
The form of the recurrence relation of the master’s theorem is:
T (n) = aT (n/b) + f(n)
where a ≥ 1 and b > 1 are constants and f(n) is an asymptotically
positive function.
In above equation:
 n = problem size
 a = number of sub problems
 n/b = size of each sub problem
 f (n) = cost of the work done outside the recursive calls
3
Master’s Theorem cases:
• If T (n) = aT (n/b) + O(nd) where d>=0, then
Example:
T(n) = 4T(n/2) + n
a = 4, b=2, f(n) = n1, so d = 1
logb a ----> log2 4 = 2
d < logba
1<2
so,
n = O (nlog2 4)
= O (n2)
4
PROBLEM STATEMENT:
The earlier used theorem has some limitations. Some equations could not be solved
using the original master’s theorem.
Here are some examples:
T(n)= 0.5T(n/2) + n
In this equation a<1. The number of subproblems is 0.5 whereas there needs to be
at least 1 subproblem.
T(n)= 2T(n/2) + n/log n
Master theorem apply only for polynomial, the difference here is not polynomial but
logarithmic.
T(n)= 2n T(n/2) + nn
Now in this case we can see that ‘a’ is not a constant therefore master’s theorem
won’t be applied.
So, to resolve such problems the master’s theorem has been revised.
5
SOLUTION:
T(n)=aT(n/b) + θ (nd logp n)
(a>=1, b>=1, d>=0 and p is a real number)
• Case 1:
If d < logb a, then T(n) = θ (nlogb a)
• Case 2:
If d = logb a
 If p > -1 then, T(n) = θ (nd logp+1 n)
 If p = -1 then, T(n) = θ (nd log log n)
 If p < -1 then, T(n) = θ (nd)
• Case 3:
If d > logb a
 If p >= 0 then, T(n) = θ (nd logp n)
 If p < 0 then, T(n) = O (nd)
6
The proposed solution is used to solve the problem like:
Example:
T(n) = 64T (n/8) + n2 log n
Now we will compare the above equation with proposed format we got.
a = 64, b = 8, d = 2, p = 1
Let’s compute logba: log8 64 = 2
2 = 2
logba = d
So, it satisfies the 2nd case i.e T(n) = θ (nd logp+1 n)
Therefore, the solution is θ (n2 log2 n)
7
Here’s another example:
T(n)= 2T(n/2) + n/log n
Now we will compare the above equation with proposed format we got.
a = 2, b = 2, d = 1, p = -1;
Let’s compute logba: log2 2 = 1
1 = 1
logba = d
So, it satisfies the 2nd case i.e T(n) = θ (nd loglog n)
Therefore the solution is θ (n loglog n)
8
CONCLUSION:
• Those equations that could not be solved using the original master’s
method but after the relaxation of the constraints they can be solved
using the new approach.
• It also helps us to reduce the time complexity in comparison if the
relation is solved using iterative and substitution method.
• The proposed method is able to relax some of the constraints of the
original method.
9
THANK YOU!
10

More Related Content

Similar to Improvised Master's Theorem

Recurrence relationclass 5
Recurrence relationclass 5Recurrence relationclass 5
Recurrence relationclass 5Kumar
 
Recurrences
RecurrencesRecurrences
RecurrencesDEVTYPE
 
RECURRENCE EQUATIONS & ANALYZING THEM
RECURRENCE EQUATIONS & ANALYZING THEMRECURRENCE EQUATIONS & ANALYZING THEM
RECURRENCE EQUATIONS & ANALYZING THEMAlpana Ingale
 
Recurrence relation solutions
Recurrence relation solutionsRecurrence relation solutions
Recurrence relation solutionssubhashchandra197
 
Divide and conquer strategy
Divide and conquer strategyDivide and conquer strategy
Divide and conquer strategyNisha Soms
 
T2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxT2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxGadaFarhan
 
Recurrence relation
Recurrence relationRecurrence relation
Recurrence relationAjay Chimmani
 
Algorithm Design and Complexity - Course 3
Algorithm Design and Complexity - Course 3Algorithm Design and Complexity - Course 3
Algorithm Design and Complexity - Course 3Traian Rebedea
 
CS330-Lectures Statistics And Probability
CS330-Lectures Statistics And ProbabilityCS330-Lectures Statistics And Probability
CS330-Lectures Statistics And Probabilitybryan111472
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquerVikas Sharma
 
Solving recurrences
Solving recurrencesSolving recurrences
Solving recurrencesMegha V
 
Lecture 5 6_7 - divide and conquer and method of solving recurrences
Lecture 5 6_7 - divide and conquer and method of solving recurrencesLecture 5 6_7 - divide and conquer and method of solving recurrences
Lecture 5 6_7 - divide and conquer and method of solving recurrencesjayavignesh86
 
Lecture 3 complexity
Lecture 3 complexityLecture 3 complexity
Lecture 3 complexityMadhu Niket
 

Similar to Improvised Master's Theorem (20)

Recurrence relationclass 5
Recurrence relationclass 5Recurrence relationclass 5
Recurrence relationclass 5
 
AOA.pptx
AOA.pptxAOA.pptx
AOA.pptx
 
Time complexity
Time complexityTime complexity
Time complexity
 
Recurrences
RecurrencesRecurrences
Recurrences
 
RECURRENCE EQUATIONS & ANALYZING THEM
RECURRENCE EQUATIONS & ANALYZING THEMRECURRENCE EQUATIONS & ANALYZING THEM
RECURRENCE EQUATIONS & ANALYZING THEM
 
Daa chapter 2
Daa chapter 2Daa chapter 2
Daa chapter 2
 
2.pptx
2.pptx2.pptx
2.pptx
 
Recurrence relation solutions
Recurrence relation solutionsRecurrence relation solutions
Recurrence relation solutions
 
Divide and conquer strategy
Divide and conquer strategyDivide and conquer strategy
Divide and conquer strategy
 
L2
L2L2
L2
 
T2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxT2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptx
 
Recurrence relation
Recurrence relationRecurrence relation
Recurrence relation
 
3.pdf
3.pdf3.pdf
3.pdf
 
Algorithm Design and Complexity - Course 3
Algorithm Design and Complexity - Course 3Algorithm Design and Complexity - Course 3
Algorithm Design and Complexity - Course 3
 
CS330-Lectures Statistics And Probability
CS330-Lectures Statistics And ProbabilityCS330-Lectures Statistics And Probability
CS330-Lectures Statistics And Probability
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquer
 
Solving recurrences
Solving recurrencesSolving recurrences
Solving recurrences
 
Lecture 5 6_7 - divide and conquer and method of solving recurrences
Lecture 5 6_7 - divide and conquer and method of solving recurrencesLecture 5 6_7 - divide and conquer and method of solving recurrences
Lecture 5 6_7 - divide and conquer and method of solving recurrences
 
Lecture 3 complexity
Lecture 3 complexityLecture 3 complexity
Lecture 3 complexity
 
L2
L2L2
L2
 

Recently uploaded

Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A BeĂąa
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 

Recently uploaded (20)

Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 

Improvised Master's Theorem

  • 2. INTRODUCTION: • Master’s Theorem is a Popular method for solving the recurrence relations. • It is used to compute the complexity of a given divide and conquer problem in asymptotic time. • In divide and conquer problem we have three steps: Divide a large problem into smaller subproblems; Recursively solve each subproblem, then Combine solutions of the subproblems to solve the original problem. 2
  • 3. The form of the recurrence relation of the master’s theorem is: T (n) = aT (n/b) + f(n) where a ≥ 1 and b > 1 are constants and f(n) is an asymptotically positive function. In above equation:  n = problem size  a = number of sub problems  n/b = size of each sub problem  f (n) = cost of the work done outside the recursive calls 3
  • 4. Master’s Theorem cases: • If T (n) = aT (n/b) + O(nd) where d>=0, then Example: T(n) = 4T(n/2) + n a = 4, b=2, f(n) = n1, so d = 1 logb a ----> log2 4 = 2 d < logba 1<2 so, n = O (nlog2 4) = O (n2) 4
  • 5. PROBLEM STATEMENT: The earlier used theorem has some limitations. Some equations could not be solved using the original master’s theorem. Here are some examples: T(n)= 0.5T(n/2) + n In this equation a<1. The number of subproblems is 0.5 whereas there needs to be at least 1 subproblem. T(n)= 2T(n/2) + n/log n Master theorem apply only for polynomial, the difference here is not polynomial but logarithmic. T(n)= 2n T(n/2) + nn Now in this case we can see that ‘a’ is not a constant therefore master’s theorem won’t be applied. So, to resolve such problems the master’s theorem has been revised. 5
  • 6. SOLUTION: T(n)=aT(n/b) + θ (nd logp n) (a>=1, b>=1, d>=0 and p is a real number) • Case 1: If d < logb a, then T(n) = θ (nlogb a) • Case 2: If d = logb a  If p > -1 then, T(n) = θ (nd logp+1 n)  If p = -1 then, T(n) = θ (nd log log n)  If p < -1 then, T(n) = θ (nd) • Case 3: If d > logb a  If p >= 0 then, T(n) = θ (nd logp n)  If p < 0 then, T(n) = O (nd) 6
  • 7. The proposed solution is used to solve the problem like: Example: T(n) = 64T (n/8) + n2 log n Now we will compare the above equation with proposed format we got. a = 64, b = 8, d = 2, p = 1 Let’s compute logba: log8 64 = 2 2 = 2 logba = d So, it satisfies the 2nd case i.e T(n) = θ (nd logp+1 n) Therefore, the solution is θ (n2 log2 n) 7
  • 8. Here’s another example: T(n)= 2T(n/2) + n/log n Now we will compare the above equation with proposed format we got. a = 2, b = 2, d = 1, p = -1; Let’s compute logba: log2 2 = 1 1 = 1 logba = d So, it satisfies the 2nd case i.e T(n) = θ (nd loglog n) Therefore the solution is θ (n loglog n) 8
  • 9. CONCLUSION: • Those equations that could not be solved using the original master’s method but after the relaxation of the constraints they can be solved using the new approach. • It also helps us to reduce the time complexity in comparison if the relation is solved using iterative and substitution method. • The proposed method is able to relax some of the constraints of the original method. 9