SlideShare a Scribd company logo
Recurrences
• The expression:
is a recurrence.
– Recurrence: an equation that describes a function in
terms of its value on smaller functions

















1
2
2
1
)
(
n
cn
n
T
n
c
n
T
2
Master Method/Theorem
• Theorem 4.1 (page 73)
– for T(n) = aT(n/b)+f(n), n/b may be n/b or n/b.
– where a  1, b>1 are positive integers, f(n) be a non-
negative function.
1. If f(n)=O(nlogb
a-) for some >0, then T(n)= (nlogb
a
).
2. If f(n)= (nlogb
a
), then T(n)= (nlogb
a
lg n).
3. If f(n)=(nlogb
a+) for some >0, and if af(n/b) cf(n)
for some c<1 and all sufficiently large n, then T(n)=
(f(n)).
3
Implications of Master Theorem
• Comparison between f(n) and nlogb
a
(<,=,>)
• Must be asymptotically smaller (or larger) by a
polynomial, i.e., n
for some >0.
• In case 3, the “regularity” must be satisfied, i.e.,
af(n/b) cf(n) for some c<1 .
• There are gaps
– between 1 and 2: f(n) is smaller than nlogb
a
, but not
polynomially smaller.
– between 2 and 3: f(n) is larger than nlogb
a
, but not
polynomially larger.
– in case 3, if the “regularity” fails to hold.
4
Application of Master Theorem
• T(n) = 9T(n/3)+n;
– a=9,b=3, f(n) =n
– nlogb
a
= nlog3
9
=  (n2)
– f(n)=O(nlog3
9-) for =1
– By case 1, T(n) = (n2).
• T(n) = T(2n/3)+1
– a=1,b=3/2, f(n) =1
– nlogb
a
= nlog3/2
1
=  (n0) =  (1)
– By case 2, T(n)= (lg n).
5
Application of Master Theorem
• T(n) = 3T(n/4)+nlg n;
– a=3,b=4, f(n) =nlg n
– nlogb
a
= nlog4
3
=  (n0.793)
– f(n)= (nlog4
3+) for 0.2
– Moreover, for large n, the “regularity” holds for
c=3/4.
• af(n/b) =3(n/4)lg (n/4)  (3/4)nlg n = cf(n)
– By case 3, T(n) = (f(n))= (nlg n).
6
Exception to Master Theorem
• T(n) = 2T(n/2)+nlg n;
– a=2,b=2, f(n) =nlg n
– nlogb
a
= nlog2
2
=  (n)
– f(n) is asymptotically larger than nlogb
a
, but not
polynomially larger because
– f(n)/nlogb
a
= lg n, which is asymptotically less
than n for any >0.
– Therefore,this is a gap between 2 and 3.
7
Where Are the Gaps
nlogba f(n), case 2: within constant distances
c1
c2
n
f(n), case 1, at least polynomially smaller
Gap between case 1 and 2
n Gap between case 3 and 2
f(n), case 3, at least polynomially larger
Note: 1. for case 3, the regularity also must hold.
2. if f(n) is lg n smaller, then fall in gap in 1 and 2
3. if f(n) is lg n larger, then fall in gap in 3 and 2
4. if f(n)=(nlogba
lgk
n), then T(n)=(nlogba
lgk+1
n). (as exercise)

More Related Content

PPT
Master method theorem
PPT
Master method theorem
PDF
Recurrence and master theorem
PPT
Proof master theorem
PPT
Recurrences
PPT
Master method
PPT
recurrence relation is explained in this
PPTX
UNIT I- Session 8.pptxgdsgdgssdggdsdsgdd
Master method theorem
Master method theorem
Recurrence and master theorem
Proof master theorem
Recurrences
Master method
recurrence relation is explained in this
UNIT I- Session 8.pptxgdsgdgssdggdsdsgdd

Similar to RecurrenceAndMasterTheorem.ppt (20)

PPTX
Solving recurrences
PDF
Recurrence relation
PPTX
Recurrence relationclass 5
PPT
recurrence relations in analysis of algorithm
PDF
3.pdf
PDF
Recurrence relation solutions
PPTX
Divide and conquer strategy
PPTX
solving_recurrence_relations_using_methods.pptx
PPTX
master theorem conditions are explained in this
PDF
Master method
PPTX
3. D&C and Recurrence Relation.ppYtxVVVV
PPT
Divide and conquer
PPTX
T2311 - Ch 4_Part1.pptx
PDF
Recurrences
PDF
Master theorm practive problems with solutions
PDF
calculus-4c-1.pdf
PPT
Recursion tree method
PDF
Lecture3(b).pdf
Solving recurrences
Recurrence relation
Recurrence relationclass 5
recurrence relations in analysis of algorithm
3.pdf
Recurrence relation solutions
Divide and conquer strategy
solving_recurrence_relations_using_methods.pptx
master theorem conditions are explained in this
Master method
3. D&C and Recurrence Relation.ppYtxVVVV
Divide and conquer
T2311 - Ch 4_Part1.pptx
Recurrences
Master theorm practive problems with solutions
calculus-4c-1.pdf
Recursion tree method
Lecture3(b).pdf
Ad

Recently uploaded (20)

PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
DOCX
573137875-Attendance-Management-System-original
PDF
Well-logging-methods_new................
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
Sustainable Sites - Green Building Construction
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
573137875-Attendance-Management-System-original
Well-logging-methods_new................
Internet of Things (IOT) - A guide to understanding
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
CH1 Production IntroductoryConcepts.pptx
Model Code of Practice - Construction Work - 21102022 .pdf
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Embodied AI: Ushering in the Next Era of Intelligent Systems
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Sustainable Sites - Green Building Construction
bas. eng. economics group 4 presentation 1.pptx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Ad

RecurrenceAndMasterTheorem.ppt

  • 1. Recurrences • The expression: is a recurrence. – Recurrence: an equation that describes a function in terms of its value on smaller functions                  1 2 2 1 ) ( n cn n T n c n T
  • 2. 2 Master Method/Theorem • Theorem 4.1 (page 73) – for T(n) = aT(n/b)+f(n), n/b may be n/b or n/b. – where a  1, b>1 are positive integers, f(n) be a non- negative function. 1. If f(n)=O(nlogb a-) for some >0, then T(n)= (nlogb a ). 2. If f(n)= (nlogb a ), then T(n)= (nlogb a lg n). 3. If f(n)=(nlogb a+) for some >0, and if af(n/b) cf(n) for some c<1 and all sufficiently large n, then T(n)= (f(n)).
  • 3. 3 Implications of Master Theorem • Comparison between f(n) and nlogb a (<,=,>) • Must be asymptotically smaller (or larger) by a polynomial, i.e., n for some >0. • In case 3, the “regularity” must be satisfied, i.e., af(n/b) cf(n) for some c<1 . • There are gaps – between 1 and 2: f(n) is smaller than nlogb a , but not polynomially smaller. – between 2 and 3: f(n) is larger than nlogb a , but not polynomially larger. – in case 3, if the “regularity” fails to hold.
  • 4. 4 Application of Master Theorem • T(n) = 9T(n/3)+n; – a=9,b=3, f(n) =n – nlogb a = nlog3 9 =  (n2) – f(n)=O(nlog3 9-) for =1 – By case 1, T(n) = (n2). • T(n) = T(2n/3)+1 – a=1,b=3/2, f(n) =1 – nlogb a = nlog3/2 1 =  (n0) =  (1) – By case 2, T(n)= (lg n).
  • 5. 5 Application of Master Theorem • T(n) = 3T(n/4)+nlg n; – a=3,b=4, f(n) =nlg n – nlogb a = nlog4 3 =  (n0.793) – f(n)= (nlog4 3+) for 0.2 – Moreover, for large n, the “regularity” holds for c=3/4. • af(n/b) =3(n/4)lg (n/4)  (3/4)nlg n = cf(n) – By case 3, T(n) = (f(n))= (nlg n).
  • 6. 6 Exception to Master Theorem • T(n) = 2T(n/2)+nlg n; – a=2,b=2, f(n) =nlg n – nlogb a = nlog2 2 =  (n) – f(n) is asymptotically larger than nlogb a , but not polynomially larger because – f(n)/nlogb a = lg n, which is asymptotically less than n for any >0. – Therefore,this is a gap between 2 and 3.
  • 7. 7 Where Are the Gaps nlogba f(n), case 2: within constant distances c1 c2 n f(n), case 1, at least polynomially smaller Gap between case 1 and 2 n Gap between case 3 and 2 f(n), case 3, at least polynomially larger Note: 1. for case 3, the regularity also must hold. 2. if f(n) is lg n smaller, then fall in gap in 1 and 2 3. if f(n) is lg n larger, then fall in gap in 3 and 2 4. if f(n)=(nlogba lgk n), then T(n)=(nlogba lgk+1 n). (as exercise)