2
Most read
3
Most read
4
Most read
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
)(
ncn
n
T
nc
nT
Dr. AMIT KUMAR @JUET
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)).
Dr. AMIT KUMAR @JUET
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.
Dr. AMIT KUMAR @JUET
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).
Dr. AMIT KUMAR @JUET
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).
Dr. AMIT KUMAR @JUET
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.
Dr. AMIT KUMAR @JUET
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)
Dr. AMIT KUMAR @JUET

More Related Content

PDF
PDF
Differential Geometry
PPTX
Divide by N clock
PPTX
Discrete Input module block diagram and wiring in PLC
PPT
Lecture7 Signal and Systems
PDF
Feedback linearisation
PPTX
Time domain analysis
PDF
9 d55201 testing & testability
Differential Geometry
Divide by N clock
Discrete Input module block diagram and wiring in PLC
Lecture7 Signal and Systems
Feedback linearisation
Time domain analysis
9 d55201 testing & testability

Similar to Recurrence and master theorem (20)

PPT
RecurrenceAndMasterTheorem.ppt
PPT
Master method theorem
PPT
Master method theorem
PPT
Time complexity
PDF
Master method
PDF
Master theorm practive problems with solutions
PPTX
UNIT I- Session 8.pptxgdsgdgssdggdsdsgdd
PPTX
Recurrence relationclass 5
PPTX
Improvised Master's Theorem
PPT
Proof master theorem
PPT
Solving Recurrence slides with images.ppt
PPTX
master theorem conditions are explained in this
PPTX
AOA.pptx
PDF
Lecture no 9(extended master method)
PDF
Master’s theorem Derivative Analysis
PDF
Recurrence relation solutions
PDF
Master theorem
PPTX
solving_recurrence_relations_using_methods.pptx
RecurrenceAndMasterTheorem.ppt
Master method theorem
Master method theorem
Time complexity
Master method
Master theorm practive problems with solutions
UNIT I- Session 8.pptxgdsgdgssdggdsdsgdd
Recurrence relationclass 5
Improvised Master's Theorem
Proof master theorem
Solving Recurrence slides with images.ppt
master theorem conditions are explained in this
AOA.pptx
Lecture no 9(extended master method)
Master’s theorem Derivative Analysis
Recurrence relation solutions
Master theorem
solving_recurrence_relations_using_methods.pptx
Ad

More from Amit Kumar Rathi (20)

PDF
Hybrid Systems using Fuzzy, NN and GA (Soft Computing)
PDF
Fundamentals of Genetic Algorithms (Soft Computing)
PDF
Fuzzy Systems by using fuzzy set (Soft Computing)
PDF
Fuzzy Set Theory and Classical Set Theory (Soft Computing)
PDF
Associative Memory using NN (Soft Computing)
PDF
Back Propagation Network (Soft Computing)
PDF
Fundamentals of Neural Network (Soft Computing)
PDF
Introduction to Soft Computing (intro to the building blocks of SC)
PDF
Topological sorting
PDF
String matching, naive,
PDF
Shortest path algorithms
PDF
Sccd and topological sorting
PDF
Red black trees
PDF
Rabin karp string matcher
PDF
Minimum spanning tree
PDF
Merge sort analysis
PDF
Loop invarient
PDF
Linear sort
PDF
Heap and heapsort
PDF
Greedy algorithm activity selection fractional
Hybrid Systems using Fuzzy, NN and GA (Soft Computing)
Fundamentals of Genetic Algorithms (Soft Computing)
Fuzzy Systems by using fuzzy set (Soft Computing)
Fuzzy Set Theory and Classical Set Theory (Soft Computing)
Associative Memory using NN (Soft Computing)
Back Propagation Network (Soft Computing)
Fundamentals of Neural Network (Soft Computing)
Introduction to Soft Computing (intro to the building blocks of SC)
Topological sorting
String matching, naive,
Shortest path algorithms
Sccd and topological sorting
Red black trees
Rabin karp string matcher
Minimum spanning tree
Merge sort analysis
Loop invarient
Linear sort
Heap and heapsort
Greedy algorithm activity selection fractional
Ad

Recently uploaded (20)

PPTX
quantum theory on the next future in.pptx
PDF
ITEC 1010 - Networks and Cloud Computing
PPT
Module_1_Lecture_1_Introduction_To_Automation_In_Production_Systems2023.ppt
PPTX
1. Effective HSEW Induction Training - EMCO 2024, O&M.pptx
PPTX
240409 Data Center Training Programs by Uptime Institute (Drafting).pptx
PDF
Electrical & Computer Engineering: An International Journal (ECIJ)
PDF
MACCAFERRY GUIA GAVIONES TERRAPLENES EN ESPAÑOL
PDF
CB Công Nghiệp Slide .dh bách khoa đà nẵng
PDF
Project_Mgmt_Institute_- Marc Marc Marc.pdf
PPTX
IOP Unit 1.pptx for btech 1st year students
PDF
Introduction to Machine Learning -Basic concepts,Models and Description
PPTX
non conventional energy resorses material unit-1
PDF
Application of smart robotics in the supply chain
PPTX
Research Writing, Mechanical Engineering
PDF
Software defined netwoks is useful to learn NFV and virtual Lans
PPTX
DATA STRCUTURE LABORATORY -BCSL305(PRG1)
PDF
V2500 Owner and Operatore Guide for Airbus
PPTX
Unit I - Mechatronics.pptx presentation
PDF
ANTIOXIDANT AND ANTIMICROBIAL ACTIVITIES OF ALGERIAN POPULUS NIGRA L. BUDS EX...
PPTX
MODULE 02 - CLOUD COMPUTING-Virtual Machines and Virtualization of Clusters a...
quantum theory on the next future in.pptx
ITEC 1010 - Networks and Cloud Computing
Module_1_Lecture_1_Introduction_To_Automation_In_Production_Systems2023.ppt
1. Effective HSEW Induction Training - EMCO 2024, O&M.pptx
240409 Data Center Training Programs by Uptime Institute (Drafting).pptx
Electrical & Computer Engineering: An International Journal (ECIJ)
MACCAFERRY GUIA GAVIONES TERRAPLENES EN ESPAÑOL
CB Công Nghiệp Slide .dh bách khoa đà nẵng
Project_Mgmt_Institute_- Marc Marc Marc.pdf
IOP Unit 1.pptx for btech 1st year students
Introduction to Machine Learning -Basic concepts,Models and Description
non conventional energy resorses material unit-1
Application of smart robotics in the supply chain
Research Writing, Mechanical Engineering
Software defined netwoks is useful to learn NFV and virtual Lans
DATA STRCUTURE LABORATORY -BCSL305(PRG1)
V2500 Owner and Operatore Guide for Airbus
Unit I - Mechatronics.pptx presentation
ANTIOXIDANT AND ANTIMICROBIAL ACTIVITIES OF ALGERIAN POPULUS NIGRA L. BUDS EX...
MODULE 02 - CLOUD COMPUTING-Virtual Machines and Virtualization of Clusters a...

Recurrence and master theorem

  • 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 )( ncn n T nc nT Dr. AMIT KUMAR @JUET
  • 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)). Dr. AMIT KUMAR @JUET
  • 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. Dr. AMIT KUMAR @JUET
  • 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). Dr. AMIT KUMAR @JUET
  • 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). Dr. AMIT KUMAR @JUET
  • 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. Dr. AMIT KUMAR @JUET
  • 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) Dr. AMIT KUMAR @JUET