SlideShare a Scribd company logo
Master Theorem Simplified
Cases, Examples & Explanations
Master Theorem
• T(n) = a * T(n/b) + f(n)
• Where:
• a = number of subproblems
• b = factor by which the problem size is divided
• f(n) = cost of work outside the recursion
• We compare f(n) with n^log_b a to find the
dominant term.
Case 1: Recursion Dominates
• If f(n) = O(n^{log_b a - ε}) for some ε > 0
• Then: T(n) = Θ(n^{log_b a})
• Example:
• T(n) = 8T(n/2) + n
• ⇒ a = 8, b = 2, log_b a = 3
• ⇒ f(n) = O(n)
• ⇒ T(n) = Θ(n^3)
Case 2: Equal Work
• If f(n) = Θ(n^{log_b a})
• Then: T(n) = Θ(n^{log_b a} * log n)
• Example:
• T(n) = 2T(n/2) + n
• ⇒ a = 2, b = 2, log_b a = 1
• ⇒ f(n) = Θ(n)
• ⇒ T(n) = Θ(n log n)
Case 3: Outside Work Dominates
• If f(n) = Ω(n^{log_b a + ε}) for some ε > 0
• AND regularity condition holds:
• a * f(n/b) ≤ c * f(n) for some c < 1
• Then: T(n) = Θ(f(n))
• Example:
• T(n) = 2T(n/2) + n^2
• ⇒ a = 2, b = 2, log_b a = 1
What is ε (Epsilon)?
• ε is a small positive constant.
• Used to compare f(n) to n^{log_b a}:
• - Case 1: f(n) is a little smaller
• - Case 2: f(n) is the same
• - Case 3: f(n) is a little bigger
• It helps identify which part dominates in time
complexity.
What Does 'Equal Work' Mean?
• 'Equal work' means:
• Time spent in recursion ≈ Time spent outside
recursion
• Formally:
• f(n) = Θ(n^{log_b a})
• Example:
• T(n) = 2T(n/2) + n Both parts grow at the
⇒
Summary of All Cases
• Case 1: Recursion Dominates
• - f(n) = O(n^{log_b a - ε})
• - T(n) = Θ(n^{log_b a})
• Case 2: Equal Work
• - f(n) = Θ(n^{log_b a})
• - T(n) = Θ(n^{log_b a} log n)
• Case 3: Outside Work Dominates

More Related Content

PPT
Time complexity
PPTX
Improvised Master's Theorem
PPTX
Solving recurrences
PPTX
UNIT I- Session 8.pptxgdsgdgssdggdsdsgdd
PPTX
Recurrence relationclass 5
PPT
RecurrenceAndMasterTheorem.ppt
PPT
Master method theorem
Time complexity
Improvised Master's Theorem
Solving recurrences
UNIT I- Session 8.pptxgdsgdgssdggdsdsgdd
Recurrence relationclass 5
RecurrenceAndMasterTheorem.ppt
Master method theorem

Similar to master theorem conditions are explained in this (20)

PPT
Master method theorem
PDF
6_12_13Asymptotic analysiskfnhlkjsbfbkjs.pdf
PDF
Recurrence relation solutions
PDF
3.pdf
PDF
Recurrence and master theorem
PDF
Master method
PDF
Master’s theorem Derivative Analysis
PPT
recurrence relation is explained in this
PDF
02 Notes Divide and Conquer
PDF
Master theorem
PPTX
solving_recurrence_relations_using_methods.pptx
PPT
Solving Recurrence slides with images.ppt
PPT
CS8451 - Design and Analysis of Algorithms
PDF
Master theorm practive problems with solutions
PDF
Complexity analysis
PPTX
AOA.pptx
PPT
Recurrences
PDF
Algorithm chapter 2
Master method theorem
6_12_13Asymptotic analysiskfnhlkjsbfbkjs.pdf
Recurrence relation solutions
3.pdf
Recurrence and master theorem
Master method
Master’s theorem Derivative Analysis
recurrence relation is explained in this
02 Notes Divide and Conquer
Master theorem
solving_recurrence_relations_using_methods.pptx
Solving Recurrence slides with images.ppt
CS8451 - Design and Analysis of Algorithms
Master theorm practive problems with solutions
Complexity analysis
AOA.pptx
Recurrences
Algorithm chapter 2
Ad

More from vidhyapm2 (12)

PPTX
building cloud wit eucalyptus is described in this
PPT
prune and search method is explained here
PPT
recurrence relations in analysis of algorithm
PPT
searching via traversal. binary search tree
PPT
recursion based on koffmann and wolfgang
PPTX
introduction to data structures in pandas
PPTX
hand assembly of sic/xe architecture is explained in this
PPT
security mechanisms required for cloud computing
PPT
cloud management mechanisms are included in this
PPT
cloud computing architectures. different architectures
PPT
cloud delivery model considerations are explained here
PPT
cloud infrasturture mechanisms are being explained here
building cloud wit eucalyptus is described in this
prune and search method is explained here
recurrence relations in analysis of algorithm
searching via traversal. binary search tree
recursion based on koffmann and wolfgang
introduction to data structures in pandas
hand assembly of sic/xe architecture is explained in this
security mechanisms required for cloud computing
cloud management mechanisms are included in this
cloud computing architectures. different architectures
cloud delivery model considerations are explained here
cloud infrasturture mechanisms are being explained here
Ad

Recently uploaded (20)

PPTX
Geodesy 1.pptx...............................................
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
Digital Logic Computer Design lecture notes
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
Welding lecture in detail for understanding
PPTX
web development for engineering and engineering
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
Well-logging-methods_new................
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
DOCX
573137875-Attendance-Management-System-original
PPTX
Sustainable Sites - Green Building Construction
Geodesy 1.pptx...............................................
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Digital Logic Computer Design lecture notes
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Internet of Things (IOT) - A guide to understanding
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
CH1 Production IntroductoryConcepts.pptx
Welding lecture in detail for understanding
web development for engineering and engineering
Foundation to blockchain - A guide to Blockchain Tech
OOP with Java - Java Introduction (Basics)
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Well-logging-methods_new................
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
573137875-Attendance-Management-System-original
Sustainable Sites - Green Building Construction

master theorem conditions are explained in this

  • 1. Master Theorem Simplified Cases, Examples & Explanations
  • 2. Master Theorem • T(n) = a * T(n/b) + f(n) • Where: • a = number of subproblems • b = factor by which the problem size is divided • f(n) = cost of work outside the recursion • We compare f(n) with n^log_b a to find the dominant term.
  • 3. Case 1: Recursion Dominates • If f(n) = O(n^{log_b a - ε}) for some ε > 0 • Then: T(n) = Θ(n^{log_b a}) • Example: • T(n) = 8T(n/2) + n • ⇒ a = 8, b = 2, log_b a = 3 • ⇒ f(n) = O(n) • ⇒ T(n) = Θ(n^3)
  • 4. Case 2: Equal Work • If f(n) = Θ(n^{log_b a}) • Then: T(n) = Θ(n^{log_b a} * log n) • Example: • T(n) = 2T(n/2) + n • ⇒ a = 2, b = 2, log_b a = 1 • ⇒ f(n) = Θ(n) • ⇒ T(n) = Θ(n log n)
  • 5. Case 3: Outside Work Dominates • If f(n) = Ω(n^{log_b a + ε}) for some ε > 0 • AND regularity condition holds: • a * f(n/b) ≤ c * f(n) for some c < 1 • Then: T(n) = Θ(f(n)) • Example: • T(n) = 2T(n/2) + n^2 • ⇒ a = 2, b = 2, log_b a = 1
  • 6. What is ε (Epsilon)? • ε is a small positive constant. • Used to compare f(n) to n^{log_b a}: • - Case 1: f(n) is a little smaller • - Case 2: f(n) is the same • - Case 3: f(n) is a little bigger • It helps identify which part dominates in time complexity.
  • 7. What Does 'Equal Work' Mean? • 'Equal work' means: • Time spent in recursion ≈ Time spent outside recursion • Formally: • f(n) = Θ(n^{log_b a}) • Example: • T(n) = 2T(n/2) + n Both parts grow at the ⇒
  • 8. Summary of All Cases • Case 1: Recursion Dominates • - f(n) = O(n^{log_b a - ε}) • - T(n) = Θ(n^{log_b a}) • Case 2: Equal Work • - f(n) = Θ(n^{log_b a}) • - T(n) = Θ(n^{log_b a} log n) • Case 3: Outside Work Dominates