SlideShare una empresa de Scribd logo
1 de 13
Solving Recurrences
The Master Theorem
Recurrence Relations
Recurrences
• The expression:

c
T ( n)

n 1

n
2T
2

cn n 1

is a recurrence.

– Recurrence: an equation that describes a function in
terms of its value on smaller functions
Recurrence Examples
s(n)

0

c s(n 1) n 0

c
T ( n)

n 0

n
2T
2

s(n)

n 1

0

n 0

n s(n 1) n 0

c

n 1

n
aT
b

cn n 1

T ( n)
c n 1
Solving Recurrences
• Substitution method
• Iteration method
• Master method
Solving Recurrences
• The substitution method (CLR 4.1)
– “Making a good guess” method
– Guess the form of the answer, then use
induction to find the constants and show that
solution works
– Examples:
• T(n) = 2T(n/2) + (n)  T(n) =
• T(n) = 2T( n/2 ) + n  ???

(n lg n)
The Master Theorem
• Given: a divide and conquer algorithm
– An algorithm that divides the problem of size
n into a subproblems, each of size n/b
– Let the cost of each stage (i.e., the work to
divide the problem + combine solved
subproblems) be described by the function
f(n)

• Then, the Master Theorem gives us a
cookbook for the algorithm’s running time:
The Master Theorem
• if T(n) = aT(n/b) + f(n) then
n log b a
T ( n)

f (n) O n log b a

log b a

log b a

n

f ( n)

log n

f ( n)

n

f ( n)
n log b a AND
af (n / b) cf (n) for large n

0
c 1
Using The Master Method
• T(n) = 9T(n/3) + n
– a=9, b=3, f(n) = n
– nlog a = nlog 9 = (n2)
– Since f(n) = O(nlog 9 - ), where =1, case 1
applies:
b

3

3

T ( n)

n

log b a

when f (n) O n

– Thus the solution is T(n) =

(n2)

log b a
Simplified Masters Theorem
nd
T ( n)

d

if (a b d )
d

n log n

if (a b )

n log ba log n

if (a b d )
• In divide and conquer generally, a problem
instance size of n is divided into two instances of
n/2. More generally an instance of size n can be
divided into b instances of size n/b, with 'a' of the
needing to be solved. ( hence, 'a' and b are
constants; a>=1 and b>1). Assuming that size n
is a power of b, by simplifying the analysis, the
recurrence for the running time
»T(n)=aT(n/b)+f(n)
• Where f(n) is a function that accounts for the time
spent on dividing the problem into smaller ones
and on combining their solutions.
More Examples of Master’s
Theorem
•
•
•
•
•

T(n) = 3T(n/5) + n
T(n) = 2T(n/2) + n
T(n) = 2T(n/2) + 1
T(n) = T(n/2) + n
T(n) = T(n/2) + 1
When Master’s Theorem cannot
be applied
• T(n) = 2T(n/2) + n logn
• T(n) = 2T(n/2) + n/ logn

Más contenido relacionado

La actualidad más candente

Recurrence Relation
Recurrence RelationRecurrence Relation
Recurrence RelationPapu Kumar
 
RECURRENCE EQUATIONS & ANALYZING THEM
RECURRENCE EQUATIONS & ANALYZING THEMRECURRENCE EQUATIONS & ANALYZING THEM
RECURRENCE EQUATIONS & ANALYZING THEMAlpana Ingale
 
Modeling with Recurrence Relations
Modeling with Recurrence RelationsModeling with Recurrence Relations
Modeling with Recurrence RelationsDevanshu Taneja
 
Daa linear recurrences
Daa linear recurrencesDaa linear recurrences
Daa linear recurrencesAtul Verma
 
Recursion tree method
Recursion tree methodRecursion tree method
Recursion tree methodRajendran
 
Analysis Of Algorithms Ii
Analysis Of Algorithms IiAnalysis Of Algorithms Ii
Analysis Of Algorithms IiSri Prasanna
 
Algorithm Design and Complexity - Course 3
Algorithm Design and Complexity - Course 3Algorithm Design and Complexity - Course 3
Algorithm Design and Complexity - Course 3Traian Rebedea
 
Master method
Master method Master method
Master method Rajendran
 
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
 
A Proof of Twin primes and Golbach's Conjecture
A Proof of Twin primes and Golbach's ConjectureA Proof of Twin primes and Golbach's Conjecture
A Proof of Twin primes and Golbach's Conjecturenikos mantzakouras
 
New Formulas for the Euler-Mascheroni Constant
New Formulas for the Euler-Mascheroni Constant New Formulas for the Euler-Mascheroni Constant
New Formulas for the Euler-Mascheroni Constant nikos mantzakouras
 
Hypothesis of Riemann's (Comprehensive Analysis)
 Hypothesis of Riemann's (Comprehensive Analysis) Hypothesis of Riemann's (Comprehensive Analysis)
Hypothesis of Riemann's (Comprehensive Analysis)nikos mantzakouras
 
Dinive conquer algorithm
Dinive conquer algorithmDinive conquer algorithm
Dinive conquer algorithmMohd Arif
 

La actualidad más candente (20)

Recurrence Relation
Recurrence RelationRecurrence Relation
Recurrence Relation
 
RECURRENCE EQUATIONS & ANALYZING THEM
RECURRENCE EQUATIONS & ANALYZING THEMRECURRENCE EQUATIONS & ANALYZING THEM
RECURRENCE EQUATIONS & ANALYZING THEM
 
Time complexity
Time complexityTime complexity
Time complexity
 
Modeling with Recurrence Relations
Modeling with Recurrence RelationsModeling with Recurrence Relations
Modeling with Recurrence Relations
 
Master method
Master methodMaster method
Master method
 
Recurrences
RecurrencesRecurrences
Recurrences
 
Master theorem
Master theoremMaster theorem
Master theorem
 
Daa linear recurrences
Daa linear recurrencesDaa linear recurrences
Daa linear recurrences
 
L2
L2L2
L2
 
Recursion tree method
Recursion tree methodRecursion tree method
Recursion tree method
 
Analysis Of Algorithms Ii
Analysis Of Algorithms IiAnalysis Of Algorithms Ii
Analysis Of Algorithms Ii
 
Algorithm Design and Complexity - Course 3
Algorithm Design and Complexity - Course 3Algorithm Design and Complexity - Course 3
Algorithm Design and Complexity - Course 3
 
Master method
Master method Master method
Master method
 
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
 
A Proof of Twin primes and Golbach's Conjecture
A Proof of Twin primes and Golbach's ConjectureA Proof of Twin primes and Golbach's Conjecture
A Proof of Twin primes and Golbach's Conjecture
 
New Formulas for the Euler-Mascheroni Constant
New Formulas for the Euler-Mascheroni Constant New Formulas for the Euler-Mascheroni Constant
New Formulas for the Euler-Mascheroni Constant
 
Solve Equations
Solve EquationsSolve Equations
Solve Equations
 
Daa chapter 2
Daa chapter 2Daa chapter 2
Daa chapter 2
 
Hypothesis of Riemann's (Comprehensive Analysis)
 Hypothesis of Riemann's (Comprehensive Analysis) Hypothesis of Riemann's (Comprehensive Analysis)
Hypothesis of Riemann's (Comprehensive Analysis)
 
Dinive conquer algorithm
Dinive conquer algorithmDinive conquer algorithm
Dinive conquer algorithm
 

Destacado

Solving recurrences
Solving recurrencesSolving recurrences
Solving recurrencesWaqas Akram
 
Establishing the recurrence relation
Establishing the recurrence relationEstablishing the recurrence relation
Establishing the recurrence relationShaun Wilson
 
lecture 8
lecture 8lecture 8
lecture 8sajinsc
 
Recurrence relations
Recurrence relationsRecurrence relations
Recurrence relationsIIUM
 
01. design & analysis of agorithm intro & complexity analysis
01. design & analysis of agorithm intro & complexity analysis01. design & analysis of agorithm intro & complexity analysis
01. design & analysis of agorithm intro & complexity analysisOnkar Nath Sharma
 
Sets and disjoint sets union123
Sets and disjoint sets union123Sets and disjoint sets union123
Sets and disjoint sets union123Ankita Goyal
 
Algorithm Design and Complexity - Course 1&2
Algorithm Design and Complexity - Course 1&2Algorithm Design and Complexity - Course 1&2
Algorithm Design and Complexity - Course 1&2Traian Rebedea
 
Radix 4 FFT algorithm and it time complexity computation
Radix 4 FFT algorithm and it time complexity computationRadix 4 FFT algorithm and it time complexity computation
Radix 4 FFT algorithm and it time complexity computationRaj Jaiswal
 
Karmarkar's Algorithm For Linear Programming Problem
Karmarkar's Algorithm For Linear Programming ProblemKarmarkar's Algorithm For Linear Programming Problem
Karmarkar's Algorithm For Linear Programming ProblemAjay Dhamija
 
Divide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of PointsDivide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of PointsAmrinder Arora
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic NotationsRishabh Soni
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexityAnkit Katiyar
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1Amrinder Arora
 

Destacado (20)

Solving recurrences
Solving recurrencesSolving recurrences
Solving recurrences
 
Establishing the recurrence relation
Establishing the recurrence relationEstablishing the recurrence relation
Establishing the recurrence relation
 
Cis435 week02
Cis435 week02Cis435 week02
Cis435 week02
 
lecture 8
lecture 8lecture 8
lecture 8
 
Recurrence relations
Recurrence relationsRecurrence relations
Recurrence relations
 
Big o notation
Big o notationBig o notation
Big o notation
 
Reccurrence relations
Reccurrence relationsReccurrence relations
Reccurrence relations
 
01. design & analysis of agorithm intro & complexity analysis
01. design & analysis of agorithm intro & complexity analysis01. design & analysis of agorithm intro & complexity analysis
01. design & analysis of agorithm intro & complexity analysis
 
Sets and disjoint sets union123
Sets and disjoint sets union123Sets and disjoint sets union123
Sets and disjoint sets union123
 
02 Notes Divide and Conquer
02 Notes Divide and Conquer02 Notes Divide and Conquer
02 Notes Divide and Conquer
 
Algorithm Introduction
Algorithm IntroductionAlgorithm Introduction
Algorithm Introduction
 
Algorithm Design and Complexity - Course 1&2
Algorithm Design and Complexity - Course 1&2Algorithm Design and Complexity - Course 1&2
Algorithm Design and Complexity - Course 1&2
 
Radix 4 FFT algorithm and it time complexity computation
Radix 4 FFT algorithm and it time complexity computationRadix 4 FFT algorithm and it time complexity computation
Radix 4 FFT algorithm and it time complexity computation
 
Karmarkar's Algorithm For Linear Programming Problem
Karmarkar's Algorithm For Linear Programming ProblemKarmarkar's Algorithm For Linear Programming Problem
Karmarkar's Algorithm For Linear Programming Problem
 
Divide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of PointsDivide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of Points
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic Notations
 
Complexity of Algorithm
Complexity of AlgorithmComplexity of Algorithm
Complexity of Algorithm
 
Design & Analysis Of Algorithm
Design & Analysis Of AlgorithmDesign & Analysis Of Algorithm
Design & Analysis Of Algorithm
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexity
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1
 

Similar a Recurrence relationclass 5

Improvised Master's Theorem
Improvised Master's TheoremImprovised Master's Theorem
Improvised Master's TheoremLaiba Younas
 
T2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxT2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxGadaFarhan
 
Recurrence relation solutions
Recurrence relation solutionsRecurrence relation solutions
Recurrence relation solutionssubhashchandra197
 
Solving recurrences
Solving recurrencesSolving recurrences
Solving recurrencesMegha V
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquerVikas Sharma
 
04_Recurrences_1.ppt
04_Recurrences_1.ppt04_Recurrences_1.ppt
04_Recurrences_1.pptMouDhara1
 
8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdf
8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdf8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdf
8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdfRishikeshJha33
 
Copy of y16 02-2119divide-and-conquer
Copy of y16 02-2119divide-and-conquerCopy of y16 02-2119divide-and-conquer
Copy of y16 02-2119divide-and-conquerJoepang2015
 
270-102-divide-and-conquer_handout.pdfCS 270Algorithm.docx
270-102-divide-and-conquer_handout.pdfCS 270Algorithm.docx270-102-divide-and-conquer_handout.pdfCS 270Algorithm.docx
270-102-divide-and-conquer_handout.pdfCS 270Algorithm.docxeugeniadean34240
 
CS330-Lectures Statistics And Probability
CS330-Lectures Statistics And ProbabilityCS330-Lectures Statistics And Probability
CS330-Lectures Statistics And Probabilitybryan111472
 
Unit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdfUnit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdfAmayJaiswal4
 
5.2 divide and conquer
5.2 divide and conquer5.2 divide and conquer
5.2 divide and conquerKrish_ver2
 

Similar a Recurrence relationclass 5 (20)

Improvised Master's Theorem
Improvised Master's TheoremImprovised Master's Theorem
Improvised Master's Theorem
 
3.pdf
3.pdf3.pdf
3.pdf
 
T2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxT2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptx
 
AOA.pptx
AOA.pptxAOA.pptx
AOA.pptx
 
Recurrence relation solutions
Recurrence relation solutionsRecurrence relation solutions
Recurrence relation solutions
 
Solving recurrences
Solving recurrencesSolving recurrences
Solving recurrences
 
L2
L2L2
L2
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquer
 
04_Recurrences_1.ppt
04_Recurrences_1.ppt04_Recurrences_1.ppt
04_Recurrences_1.ppt
 
8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdf
8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdf8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdf
8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdf
 
Merge sort and quick sort
Merge sort and quick sortMerge sort and quick sort
Merge sort and quick sort
 
Copy of y16 02-2119divide-and-conquer
Copy of y16 02-2119divide-and-conquerCopy of y16 02-2119divide-and-conquer
Copy of y16 02-2119divide-and-conquer
 
270-102-divide-and-conquer_handout.pdfCS 270Algorithm.docx
270-102-divide-and-conquer_handout.pdfCS 270Algorithm.docx270-102-divide-and-conquer_handout.pdfCS 270Algorithm.docx
270-102-divide-and-conquer_handout.pdfCS 270Algorithm.docx
 
CS330-Lectures Statistics And Probability
CS330-Lectures Statistics And ProbabilityCS330-Lectures Statistics And Probability
CS330-Lectures Statistics And Probability
 
Merge Sort
Merge SortMerge Sort
Merge Sort
 
Unit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdfUnit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdf
 
03 dc
03 dc03 dc
03 dc
 
5.2 divide and conquer
5.2 divide and conquer5.2 divide and conquer
5.2 divide and conquer
 
Unit 3
Unit 3Unit 3
Unit 3
 
Unit 3
Unit 3Unit 3
Unit 3
 

Más de Kumar

Graphics devices
Graphics devicesGraphics devices
Graphics devicesKumar
 
Fill area algorithms
Fill area algorithmsFill area algorithms
Fill area algorithmsKumar
 
region-filling
region-fillingregion-filling
region-fillingKumar
 
Bresenham derivation
Bresenham derivationBresenham derivation
Bresenham derivationKumar
 
Bresenham circles and polygons derication
Bresenham circles and polygons dericationBresenham circles and polygons derication
Bresenham circles and polygons dericationKumar
 
Introductionto xslt
Introductionto xsltIntroductionto xslt
Introductionto xsltKumar
 
Extracting data from xml
Extracting data from xmlExtracting data from xml
Extracting data from xmlKumar
 
Xml basics
Xml basicsXml basics
Xml basicsKumar
 
XML Schema
XML SchemaXML Schema
XML SchemaKumar
 
Publishing xml
Publishing xmlPublishing xml
Publishing xmlKumar
 
Applying xml
Applying xmlApplying xml
Applying xmlKumar
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XMLKumar
 
How to deploy a j2ee application
How to deploy a j2ee applicationHow to deploy a j2ee application
How to deploy a j2ee applicationKumar
 
JNDI, JMS, JPA, XML
JNDI, JMS, JPA, XMLJNDI, JMS, JPA, XML
JNDI, JMS, JPA, XMLKumar
 
EJB Fundmentals
EJB FundmentalsEJB Fundmentals
EJB FundmentalsKumar
 
JSP and struts programming
JSP and struts programmingJSP and struts programming
JSP and struts programmingKumar
 
java servlet and servlet programming
java servlet and servlet programmingjava servlet and servlet programming
java servlet and servlet programmingKumar
 
Introduction to JDBC and JDBC Drivers
Introduction to JDBC and JDBC DriversIntroduction to JDBC and JDBC Drivers
Introduction to JDBC and JDBC DriversKumar
 
Introduction to J2EE
Introduction to J2EEIntroduction to J2EE
Introduction to J2EEKumar
 

Más de Kumar (20)

Graphics devices
Graphics devicesGraphics devices
Graphics devices
 
Fill area algorithms
Fill area algorithmsFill area algorithms
Fill area algorithms
 
region-filling
region-fillingregion-filling
region-filling
 
Bresenham derivation
Bresenham derivationBresenham derivation
Bresenham derivation
 
Bresenham circles and polygons derication
Bresenham circles and polygons dericationBresenham circles and polygons derication
Bresenham circles and polygons derication
 
Introductionto xslt
Introductionto xsltIntroductionto xslt
Introductionto xslt
 
Extracting data from xml
Extracting data from xmlExtracting data from xml
Extracting data from xml
 
Xml basics
Xml basicsXml basics
Xml basics
 
XML Schema
XML SchemaXML Schema
XML Schema
 
Publishing xml
Publishing xmlPublishing xml
Publishing xml
 
DTD
DTDDTD
DTD
 
Applying xml
Applying xmlApplying xml
Applying xml
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
How to deploy a j2ee application
How to deploy a j2ee applicationHow to deploy a j2ee application
How to deploy a j2ee application
 
JNDI, JMS, JPA, XML
JNDI, JMS, JPA, XMLJNDI, JMS, JPA, XML
JNDI, JMS, JPA, XML
 
EJB Fundmentals
EJB FundmentalsEJB Fundmentals
EJB Fundmentals
 
JSP and struts programming
JSP and struts programmingJSP and struts programming
JSP and struts programming
 
java servlet and servlet programming
java servlet and servlet programmingjava servlet and servlet programming
java servlet and servlet programming
 
Introduction to JDBC and JDBC Drivers
Introduction to JDBC and JDBC DriversIntroduction to JDBC and JDBC Drivers
Introduction to JDBC and JDBC Drivers
 
Introduction to J2EE
Introduction to J2EEIntroduction to J2EE
Introduction to J2EE
 

Último

Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfSanaAli374401
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 

Último (20)

Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 

Recurrence relationclass 5

  • 3. Recurrences • The expression: c T ( n) n 1 n 2T 2 cn n 1 is a recurrence. – Recurrence: an equation that describes a function in terms of its value on smaller functions
  • 4. Recurrence Examples s(n) 0 c s(n 1) n 0 c T ( n) n 0 n 2T 2 s(n) n 1 0 n 0 n s(n 1) n 0 c n 1 n aT b cn n 1 T ( n) c n 1
  • 5. Solving Recurrences • Substitution method • Iteration method • Master method
  • 6. Solving Recurrences • The substitution method (CLR 4.1) – “Making a good guess” method – Guess the form of the answer, then use induction to find the constants and show that solution works – Examples: • T(n) = 2T(n/2) + (n)  T(n) = • T(n) = 2T( n/2 ) + n  ??? (n lg n)
  • 7. The Master Theorem • Given: a divide and conquer algorithm – An algorithm that divides the problem of size n into a subproblems, each of size n/b – Let the cost of each stage (i.e., the work to divide the problem + combine solved subproblems) be described by the function f(n) • Then, the Master Theorem gives us a cookbook for the algorithm’s running time:
  • 8. The Master Theorem • if T(n) = aT(n/b) + f(n) then n log b a T ( n) f (n) O n log b a log b a log b a n f ( n) log n f ( n) n f ( n) n log b a AND af (n / b) cf (n) for large n 0 c 1
  • 9. Using The Master Method • T(n) = 9T(n/3) + n – a=9, b=3, f(n) = n – nlog a = nlog 9 = (n2) – Since f(n) = O(nlog 9 - ), where =1, case 1 applies: b 3 3 T ( n) n log b a when f (n) O n – Thus the solution is T(n) = (n2) log b a
  • 10. Simplified Masters Theorem nd T ( n) d if (a b d ) d n log n if (a b ) n log ba log n if (a b d )
  • 11. • In divide and conquer generally, a problem instance size of n is divided into two instances of n/2. More generally an instance of size n can be divided into b instances of size n/b, with 'a' of the needing to be solved. ( hence, 'a' and b are constants; a>=1 and b>1). Assuming that size n is a power of b, by simplifying the analysis, the recurrence for the running time »T(n)=aT(n/b)+f(n) • Where f(n) is a function that accounts for the time spent on dividing the problem into smaller ones and on combining their solutions.
  • 12. More Examples of Master’s Theorem • • • • • T(n) = 3T(n/5) + n T(n) = 2T(n/2) + n T(n) = 2T(n/2) + 1 T(n) = T(n/2) + n T(n) = T(n/2) + 1
  • 13. When Master’s Theorem cannot be applied • T(n) = 2T(n/2) + n logn • T(n) = 2T(n/2) + n/ logn