SlideShare a Scribd company logo
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 5
Kumar
 
AOA.pptx
AOA.pptxAOA.pptx
AOA.pptx
RidyaGupta1
 
Time complexity
Time complexityTime complexity
Time complexity
Kartik Chandra Mandal
 
Recurrences
RecurrencesRecurrences
Recurrences
DEVTYPE
 
RECURRENCE EQUATIONS & ANALYZING THEM
RECURRENCE EQUATIONS & ANALYZING THEMRECURRENCE EQUATIONS & ANALYZING THEM
RECURRENCE EQUATIONS & ANALYZING THEM
Alpana Ingale
 
Daa chapter 2
Daa chapter 2Daa chapter 2
Daa chapter 2
B.Kirron Reddi
 
2.pptx
2.pptx2.pptx
2.pptx
MohAlyasin1
 
Recurrence relation solutions
Recurrence relation solutionsRecurrence relation solutions
Recurrence relation solutions
subhashchandra197
 
Divide and conquer strategy
Divide and conquer strategyDivide and conquer strategy
Divide and conquer strategy
Nisha Soms
 
L2
L2L2
T2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxT2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptx
GadaFarhan
 
Recurrence relation
Recurrence relationRecurrence relation
Recurrence relation
Ajay Chimmani
 
3.pdf
3.pdf3.pdf
3.pdf
AlaaOdeh18
 
Algorithm Design and Complexity - Course 3
Algorithm Design and Complexity - Course 3Algorithm Design and Complexity - Course 3
Algorithm Design and Complexity - Course 3
Traian Rebedea
 
CS330-Lectures Statistics And Probability
CS330-Lectures Statistics And ProbabilityCS330-Lectures Statistics And Probability
CS330-Lectures Statistics And Probability
bryan111472
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquer
Vikas Sharma
 
Solving recurrences
Solving recurrencesSolving recurrences
Solving recurrences
Megha 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 recurrences
jayavignesh86
 
Lecture 3 complexity
Lecture 3 complexityLecture 3 complexity
Lecture 3 complexity
Madhu Niket
 
L2
L2L2

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

Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Diana Rendina
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
S. Raj Kumar
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
paigestewart1632
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 

Recently uploaded (20)

Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 

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