SlideShare a Scribd company logo
DYNAMIC PROGRAMMING 2ND DAY
Lecture:168 DEBOLINA PAN
Date: 07.10.13 I.D-110811026
ANALYSIS AND DESIGN OF
ALGORITHM
Content
 Example of Finding Optimal Number of Scaler Multiplication In
Matrix Multiplication
 FindThe Optimal Number Of Parenthesization
 Compare with Bruteforce and Divide and concure method
 Where we can use dynamic programming
 Elements of Dynamic Programming
 Optimal Structure
 Proof:
 Some problems where we should not use dynamic programming
 Proof :optimal substructure property holds for unweighted
shortest path problem
 Proof :optimal substructure property holds for unweighted
longest path problem
Example of Finding Optimal Number of
Scaler Multiplication In Matrix Multiplication
 Find the optimal number of scaler products of the given
matrices:
 Matrix dimension
 A1 30*35
 A2 35*15
 A3 15*5
 A4 5*10
 A5 10*20
 A6 20*25
contd
 According to algorithm to
find the optimal number of
scaler product if
i=j,m[i,i]<-0
contd
 If we rotate this by
45degree
contd
 According to algorithm
m[i,j]=m[i,k]+m[k+1,j]
 m[1,2]=m[1,1]+m[1,2]
=0+30*35*15=15750
 m[2,3]=m[2,2]+m[2,3]
=0+35*15*5=2625
 m[3,4]=m[3,3]+m[3,4]
=0+15*5*10=750
 m[4,5]=m[4,4]+m[4,5]
=0+5*10*20=1000
 m[5,6]=m[5,5]+m[5,6]
=0+10*20*25=5000
contd
 m[1,3]=min m[1,1]+m[2,3]+
P0.P1.P3=7875 =
m[1,2]+m[3,3]+P0.P2.P3=
18000
=7875
 m[2,4]=min m[2,2]+m[3,4]+
P1.P2.P4=6000
m[2,3]+m[4,4]+
P1.P3.P4=4375
=4375
 m[3,5]=min m[3,3]+m[4,5]+
P2.P3.P5=2500
m[3,4]+m[5,5]+
P2.P4.P5=3750
= 2500
 m[4,6]= min m[4,4]+m[5,6]+
P3.P4.P6=6250
m[4,5]+m[6,6]+
P3.P5.P6=3500
= 3500
contd
contd
 m[1,4]=min m[1,1]+m[2,4] +
P0.P1.P4 =14875
m[1,2]+m[3,4]+P0.
P2.P4=21000
m[1,3]+m[4,4]+P
0.P3.P4=9375=9
357
 m[2,5]=min m[2,2]+m[3,5] +
P1.P2.P5 =13000
m[2,3]+m[4,5]+P1.
P3.P5=7125
m[2,4]+m[5,5]+P
1.P4.P5=9375
=11375
 m[3,6]=min m[3,3]+m[4,6] +
P2.P3.P6 =5375
m[3,4]+m[5,6]+P2.
P4.P6=9500
m[3,5]+m[6,6]+P
2.P5.P6=10000
=5375
contd
contd
 m[1,5]=min m[1,1]+m[2,5]+
P0.P1.P5=28125
m[1,2]+m[3,5]+
P0.P2.P5=27250
m[1,3]+m[4,5]+
P0.P2.P5=11875
m[1,4]+m[5,5]+
P0.P4.P5=15375
= 11875
 m[2,6]=min m[2,2]+m[3,6]+
P1P2.P6=18500
m[2,3]+m[4,6]+
P2.P3.P6=10500
m[2,4]+m[5,6]+
P2.P4.P6=18125
m[2,5]+m[6,6]+
P1P5.P6=24625
= 10500
contd
 m[1,6]=min m[1,1]+m[2,6]+
P0.P1.P6=36750
m[1,2]+m[3,6]+
P0.P2.P6=37000
m[1,3]+m[4,6]+
P0.P3.P6=15125
m[1,4]+m[5,6]+
P0.P4.P6=21875
m[1,5]+m[6,6]+
P0.P5.P6=26875
= 15125
Find The Optimal Number Of
Parenthesization
Complexity Of This Algorithm
 Upper bound of this number O(n^3)
 Lower bound of this problem Ω(n^3)
 Tight bound of this problem theta(n^3)
Compare with Bruteforce and Divide
and concure method
 We can solve this matrix chain optimization problem by
bruteforce method or divide n concure method.but
complexity of this problem by these methods would be
exoponential,using dynamic programming the complexity of
the algorithm becomes order of n^3.
Where we can use dynamic
programming
 We can’t use Dynamic programming to solve any
problem,problem must have some basic property to use
dynamic programming to solve them.
 For example we cant use dynamic programming for merge
sort.
for merge sort we have to sort all keys,and the keys for
merge sort are unique,and subproblems are independent.
To use dynamic programming all keys should be dependent on
each other.
We cant replace divide n concure method to dynamic
programming.
Elements of Dynamic Programming
1. Optimal structure
2. Overlapping subproblem
3. memoization
Optimal Structure
 This is the necessary property,if this property is not present
we cant use dynamic programming.
 Say,a problem p,with subproblems p1,p2.
Solution of problem p is s,and s1 is the optimum solution of
subproblem p1,and s2 is the optimum solution of
subproblem p2.
 Claim:s is the optimal solution ,if both solution of the
subproblems are optimal only then the final solution is
optimal.
Proof:
 the final solution is optimal. only when both solution of
the subproblems are optimal
 We will proof this by contradiction.
Let us take there is a another solution of subproblem p1 s1’which is
not optimal.then combining the this solutions s1’ and s2 we get
the final solution s’ which takes less number parenthesization than
s.
But we know s has the optimal number of solution.so s’cant have
number of parenthesization less than the number parenthesization
than s.
So by contradicyion we have prooved that both solution of
subproblems are optimal only when the solution of the
subproblems are optimal.
Some problems where we should not
use dynamic programming
 Consider the following two problems in which we are given a
directed graph G =(V,E)and vertices u,v €V.
 Unweighted shortest path:Find a path from u to
consisting of the fewest edges. Such a path must be simple,
since removing a cycle from a path produces a path with
fewer edges.
 Unweighted longest simple path: Find a simple path
from u to consisting of the most edges.We need to include
the requirement of simplicity because otherwise we can
traverse a cycle as many times as we like to create paths with
an arbitrarily large number of edges.
Proof :optimal substructure property holds
for unweighted shortest path problem
 There are 2 vertices u and v.
 P path is optimal if it contains
minimum number of vertices.2
subpaths
p1[u w] and p2[w->v] if the path
is optimal then the subpaths must
be optimal.
We will proof this by contradiction.
Let we have a path p1’between u and
w which is not optimal,by
combining 2 subpaths we get the
final path p’which take less number
of vertices than p.but p is
optimal.so byy contradiction we
have prooved that unweighted
shortest path problem follows
optimal substructure problem.
Proof :optimal substructure property holds
for unweighted longest path problem
 Longest path betweenA
and C: A->B->C
 Subpath A->B and B->C
should be longest.
 Longest path betweenA-
>B is: A->C->B
 Longest path between B-
>C is: B->A->C
 It does not follow optimal
structure.solution to this
problem is not possible yet.

More Related Content

What's hot

5.1 greedyyy 02
5.1 greedyyy 025.1 greedyyy 02
5.1 greedyyy 02
Krish_ver2
 
Daa unit 5
Daa unit 5Daa unit 5
Daa unit 5
Abhimanyu Mishra
 
Chapter 17
Chapter 17Chapter 17
Chapter 17
ashish bansal
 
Analysis of Algorithm
Analysis of AlgorithmAnalysis of Algorithm
Analysis of Algorithm
أحلام انصارى
 
Greedy method by Dr. B. J. Mohite
Greedy method by Dr. B. J. MohiteGreedy method by Dr. B. J. Mohite
Greedy method by Dr. B. J. Mohite
Zeal Education Society, Pune
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy method
hodcsencet
 
Brute force method
Brute force methodBrute force method
Brute force method
priyankabhansali217
 
Dynamic Programming - Part 1
Dynamic Programming - Part 1Dynamic Programming - Part 1
Dynamic Programming - Part 1
Amrinder Arora
 
lecture 26
lecture 26lecture 26
lecture 26
sajinsc
 
unit-4-dynamic programming
unit-4-dynamic programmingunit-4-dynamic programming
unit-4-dynamic programming
hodcsencet
 
Perform brute force
Perform brute forcePerform brute force
Perform brute force
SHC
 
Greedymethod
GreedymethodGreedymethod
Greedymethod
Meenakshi Devi
 
Design and Analysis of algorithms
Design and Analysis of algorithmsDesign and Analysis of algorithms
Design and Analysis of algorithms
Dr. Rupa Ch
 
Daa notes 2
Daa notes 2Daa notes 2
Daa notes 2
smruti sarangi
 
algorithm Unit 2
algorithm Unit 2 algorithm Unit 2
algorithm Unit 2
Monika Choudhery
 
DP
DPDP
Introduction to Approximation Algorithms
Introduction to Approximation AlgorithmsIntroduction to Approximation Algorithms
Introduction to Approximation Algorithms
Jhoirene Clemente
 
Algorithms Question bank
Algorithms Question bankAlgorithms Question bank
Algorithms Question bank
Shivalik college of engineering
 
04 brute force
04 brute force04 brute force
04 brute force
Hira Gul
 
The Maximum Subarray Problem
The Maximum Subarray ProblemThe Maximum Subarray Problem
The Maximum Subarray Problem
Kamran Ashraf
 

What's hot (20)

5.1 greedyyy 02
5.1 greedyyy 025.1 greedyyy 02
5.1 greedyyy 02
 
Daa unit 5
Daa unit 5Daa unit 5
Daa unit 5
 
Chapter 17
Chapter 17Chapter 17
Chapter 17
 
Analysis of Algorithm
Analysis of AlgorithmAnalysis of Algorithm
Analysis of Algorithm
 
Greedy method by Dr. B. J. Mohite
Greedy method by Dr. B. J. MohiteGreedy method by Dr. B. J. Mohite
Greedy method by Dr. B. J. Mohite
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy method
 
Brute force method
Brute force methodBrute force method
Brute force method
 
Dynamic Programming - Part 1
Dynamic Programming - Part 1Dynamic Programming - Part 1
Dynamic Programming - Part 1
 
lecture 26
lecture 26lecture 26
lecture 26
 
unit-4-dynamic programming
unit-4-dynamic programmingunit-4-dynamic programming
unit-4-dynamic programming
 
Perform brute force
Perform brute forcePerform brute force
Perform brute force
 
Greedymethod
GreedymethodGreedymethod
Greedymethod
 
Design and Analysis of algorithms
Design and Analysis of algorithmsDesign and Analysis of algorithms
Design and Analysis of algorithms
 
Daa notes 2
Daa notes 2Daa notes 2
Daa notes 2
 
algorithm Unit 2
algorithm Unit 2 algorithm Unit 2
algorithm Unit 2
 
DP
DPDP
DP
 
Introduction to Approximation Algorithms
Introduction to Approximation AlgorithmsIntroduction to Approximation Algorithms
Introduction to Approximation Algorithms
 
Algorithms Question bank
Algorithms Question bankAlgorithms Question bank
Algorithms Question bank
 
04 brute force
04 brute force04 brute force
04 brute force
 
The Maximum Subarray Problem
The Maximum Subarray ProblemThe Maximum Subarray Problem
The Maximum Subarray Problem
 

Viewers also liked

Android
AndroidAndroid
Android
debolina13
 
Randomized algorithms ver 1.0
Randomized algorithms ver 1.0Randomized algorithms ver 1.0
Randomized algorithms ver 1.0
Dr. C.V. Suresh Babu
 
Dynamic programming1
Dynamic programming1Dynamic programming1
Dynamic programming1
debolina13
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
Nv Thejaswini
 
Hashing
HashingHashing
Hashing
debolina13
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound technique
ishmecse13
 
backtracking algorithms of ada
backtracking algorithms of adabacktracking algorithms of ada
backtracking algorithms of ada
Sahil Kumar
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
Gayathri Gaayu
 
Backtracking
BacktrackingBacktracking
Backtracking
subhradeep mitra
 

Viewers also liked (9)

Android
AndroidAndroid
Android
 
Randomized algorithms ver 1.0
Randomized algorithms ver 1.0Randomized algorithms ver 1.0
Randomized algorithms ver 1.0
 
Dynamic programming1
Dynamic programming1Dynamic programming1
Dynamic programming1
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
 
Hashing
HashingHashing
Hashing
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound technique
 
backtracking algorithms of ada
backtracking algorithms of adabacktracking algorithms of ada
backtracking algorithms of ada
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
 
Backtracking
BacktrackingBacktracking
Backtracking
 

Similar to Dynamic programmng2

Introduction to dynamic programming
Introduction to dynamic programmingIntroduction to dynamic programming
Introduction to dynamic programming
Amisha Narsingani
 
Greedy Algorithms
Greedy AlgorithmsGreedy Algorithms
Greedy Algorithms
Amrinder Arora
 
Analysis and Design of Algorithms notes
Analysis and Design of Algorithms  notesAnalysis and Design of Algorithms  notes
Analysis and Design of Algorithms notes
Prof. Dr. K. Adisesha
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
jinalgoti
 
Approximation algorithms
Approximation  algorithms Approximation  algorithms
Approximation algorithms
Bipesh Raj Subedi
 
DAA-Module-5.pptx
DAA-Module-5.pptxDAA-Module-5.pptx
DAA-Module-5.pptx
smithashetty24
 
DATA STRUCTURE.pdf
DATA STRUCTURE.pdfDATA STRUCTURE.pdf
DATA STRUCTURE.pdf
ibrahim386946
 
DATA STRUCTURE
DATA STRUCTUREDATA STRUCTURE
DATA STRUCTURE
RobinRohit2
 
Dynamic programming prasintation eaisy
Dynamic programming prasintation eaisyDynamic programming prasintation eaisy
Dynamic programming prasintation eaisy
ahmed51236
 
Algorithms Design Patterns
Algorithms Design PatternsAlgorithms Design Patterns
Algorithms Design Patterns
Ashwin Shiv
 
2.03.Asymptotic_analysis.pptx
2.03.Asymptotic_analysis.pptx2.03.Asymptotic_analysis.pptx
2.03.Asymptotic_analysis.pptx
ssuser1fb3df
 
5.2 Least Squares Linear Regression.pptx
5.2  Least Squares Linear Regression.pptx5.2  Least Squares Linear Regression.pptx
5.2 Least Squares Linear Regression.pptx
MaiEllahham1
 
ALGORITHMS - SHORT NOTES
ALGORITHMS - SHORT NOTESALGORITHMS - SHORT NOTES
ALGORITHMS - SHORT NOTES
suthi
 
Daa chapter 1
Daa chapter 1Daa chapter 1
Daa chapter 1
B.Kirron Reddi
 
APLICACIONES DE LA DERIVADA EN LA CARRERA DE (Mecánica, Electrónica, Telecomu...
APLICACIONES DE LA DERIVADA EN LA CARRERA DE (Mecánica, Electrónica, Telecomu...APLICACIONES DE LA DERIVADA EN LA CARRERA DE (Mecánica, Electrónica, Telecomu...
APLICACIONES DE LA DERIVADA EN LA CARRERA DE (Mecánica, Electrónica, Telecomu...
WILIAMMAURICIOCAHUAT1
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexity
Ankit Katiyar
 
Unit3_1.pdf
Unit3_1.pdfUnit3_1.pdf
Unit3_1.pdf
Pratimakumari213460
 
Minimization of Assignment Problems
Minimization of Assignment ProblemsMinimization of Assignment Problems
Minimization of Assignment Problems
ijtsrd
 
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhh
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhhCh3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhh
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhh
danielgetachew0922
 
DSA Complexity.pptx What is Complexity Analysis? What is the need for Compl...
DSA Complexity.pptx   What is Complexity Analysis? What is the need for Compl...DSA Complexity.pptx   What is Complexity Analysis? What is the need for Compl...
DSA Complexity.pptx What is Complexity Analysis? What is the need for Compl...
2022cspaawan12556
 

Similar to Dynamic programmng2 (20)

Introduction to dynamic programming
Introduction to dynamic programmingIntroduction to dynamic programming
Introduction to dynamic programming
 
Greedy Algorithms
Greedy AlgorithmsGreedy Algorithms
Greedy Algorithms
 
Analysis and Design of Algorithms notes
Analysis and Design of Algorithms  notesAnalysis and Design of Algorithms  notes
Analysis and Design of Algorithms notes
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
 
Approximation algorithms
Approximation  algorithms Approximation  algorithms
Approximation algorithms
 
DAA-Module-5.pptx
DAA-Module-5.pptxDAA-Module-5.pptx
DAA-Module-5.pptx
 
DATA STRUCTURE.pdf
DATA STRUCTURE.pdfDATA STRUCTURE.pdf
DATA STRUCTURE.pdf
 
DATA STRUCTURE
DATA STRUCTUREDATA STRUCTURE
DATA STRUCTURE
 
Dynamic programming prasintation eaisy
Dynamic programming prasintation eaisyDynamic programming prasintation eaisy
Dynamic programming prasintation eaisy
 
Algorithms Design Patterns
Algorithms Design PatternsAlgorithms Design Patterns
Algorithms Design Patterns
 
2.03.Asymptotic_analysis.pptx
2.03.Asymptotic_analysis.pptx2.03.Asymptotic_analysis.pptx
2.03.Asymptotic_analysis.pptx
 
5.2 Least Squares Linear Regression.pptx
5.2  Least Squares Linear Regression.pptx5.2  Least Squares Linear Regression.pptx
5.2 Least Squares Linear Regression.pptx
 
ALGORITHMS - SHORT NOTES
ALGORITHMS - SHORT NOTESALGORITHMS - SHORT NOTES
ALGORITHMS - SHORT NOTES
 
Daa chapter 1
Daa chapter 1Daa chapter 1
Daa chapter 1
 
APLICACIONES DE LA DERIVADA EN LA CARRERA DE (Mecánica, Electrónica, Telecomu...
APLICACIONES DE LA DERIVADA EN LA CARRERA DE (Mecánica, Electrónica, Telecomu...APLICACIONES DE LA DERIVADA EN LA CARRERA DE (Mecánica, Electrónica, Telecomu...
APLICACIONES DE LA DERIVADA EN LA CARRERA DE (Mecánica, Electrónica, Telecomu...
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexity
 
Unit3_1.pdf
Unit3_1.pdfUnit3_1.pdf
Unit3_1.pdf
 
Minimization of Assignment Problems
Minimization of Assignment ProblemsMinimization of Assignment Problems
Minimization of Assignment Problems
 
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhh
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhhCh3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhh
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhh
 
DSA Complexity.pptx What is Complexity Analysis? What is the need for Compl...
DSA Complexity.pptx   What is Complexity Analysis? What is the need for Compl...DSA Complexity.pptx   What is Complexity Analysis? What is the need for Compl...
DSA Complexity.pptx What is Complexity Analysis? What is the need for Compl...
 

Recently uploaded

Wearable antenna for antenna applications
Wearable antenna for antenna applicationsWearable antenna for antenna applications
Wearable antenna for antenna applications
Madhumitha Jayaram
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
drwaing
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
IJNSA Journal
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
IJECEIAES
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
Divyam548318
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
Low power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniquesLow power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniques
nooriasukmaningtyas
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
mamunhossenbd75
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
ssuser36d3051
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 

Recently uploaded (20)

Wearable antenna for antenna applications
Wearable antenna for antenna applicationsWearable antenna for antenna applications
Wearable antenna for antenna applications
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
Low power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniquesLow power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniques
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 

Dynamic programmng2

  • 1. DYNAMIC PROGRAMMING 2ND DAY Lecture:168 DEBOLINA PAN Date: 07.10.13 I.D-110811026 ANALYSIS AND DESIGN OF ALGORITHM
  • 2. Content  Example of Finding Optimal Number of Scaler Multiplication In Matrix Multiplication  FindThe Optimal Number Of Parenthesization  Compare with Bruteforce and Divide and concure method  Where we can use dynamic programming  Elements of Dynamic Programming  Optimal Structure  Proof:  Some problems where we should not use dynamic programming  Proof :optimal substructure property holds for unweighted shortest path problem  Proof :optimal substructure property holds for unweighted longest path problem
  • 3. Example of Finding Optimal Number of Scaler Multiplication In Matrix Multiplication  Find the optimal number of scaler products of the given matrices:  Matrix dimension  A1 30*35  A2 35*15  A3 15*5  A4 5*10  A5 10*20  A6 20*25
  • 4. contd  According to algorithm to find the optimal number of scaler product if i=j,m[i,i]<-0
  • 5. contd  If we rotate this by 45degree
  • 6. contd  According to algorithm m[i,j]=m[i,k]+m[k+1,j]  m[1,2]=m[1,1]+m[1,2] =0+30*35*15=15750  m[2,3]=m[2,2]+m[2,3] =0+35*15*5=2625  m[3,4]=m[3,3]+m[3,4] =0+15*5*10=750  m[4,5]=m[4,4]+m[4,5] =0+5*10*20=1000  m[5,6]=m[5,5]+m[5,6] =0+10*20*25=5000
  • 7. contd  m[1,3]=min m[1,1]+m[2,3]+ P0.P1.P3=7875 = m[1,2]+m[3,3]+P0.P2.P3= 18000 =7875  m[2,4]=min m[2,2]+m[3,4]+ P1.P2.P4=6000 m[2,3]+m[4,4]+ P1.P3.P4=4375 =4375  m[3,5]=min m[3,3]+m[4,5]+ P2.P3.P5=2500 m[3,4]+m[5,5]+ P2.P4.P5=3750 = 2500  m[4,6]= min m[4,4]+m[5,6]+ P3.P4.P6=6250 m[4,5]+m[6,6]+ P3.P5.P6=3500 = 3500
  • 9. contd  m[1,4]=min m[1,1]+m[2,4] + P0.P1.P4 =14875 m[1,2]+m[3,4]+P0. P2.P4=21000 m[1,3]+m[4,4]+P 0.P3.P4=9375=9 357  m[2,5]=min m[2,2]+m[3,5] + P1.P2.P5 =13000 m[2,3]+m[4,5]+P1. P3.P5=7125 m[2,4]+m[5,5]+P 1.P4.P5=9375 =11375  m[3,6]=min m[3,3]+m[4,6] + P2.P3.P6 =5375 m[3,4]+m[5,6]+P2. P4.P6=9500 m[3,5]+m[6,6]+P 2.P5.P6=10000 =5375
  • 10. contd
  • 11. contd  m[1,5]=min m[1,1]+m[2,5]+ P0.P1.P5=28125 m[1,2]+m[3,5]+ P0.P2.P5=27250 m[1,3]+m[4,5]+ P0.P2.P5=11875 m[1,4]+m[5,5]+ P0.P4.P5=15375 = 11875  m[2,6]=min m[2,2]+m[3,6]+ P1P2.P6=18500 m[2,3]+m[4,6]+ P2.P3.P6=10500 m[2,4]+m[5,6]+ P2.P4.P6=18125 m[2,5]+m[6,6]+ P1P5.P6=24625 = 10500
  • 13. Find The Optimal Number Of Parenthesization
  • 14. Complexity Of This Algorithm  Upper bound of this number O(n^3)  Lower bound of this problem Ω(n^3)  Tight bound of this problem theta(n^3)
  • 15. Compare with Bruteforce and Divide and concure method  We can solve this matrix chain optimization problem by bruteforce method or divide n concure method.but complexity of this problem by these methods would be exoponential,using dynamic programming the complexity of the algorithm becomes order of n^3.
  • 16. Where we can use dynamic programming  We can’t use Dynamic programming to solve any problem,problem must have some basic property to use dynamic programming to solve them.  For example we cant use dynamic programming for merge sort. for merge sort we have to sort all keys,and the keys for merge sort are unique,and subproblems are independent. To use dynamic programming all keys should be dependent on each other. We cant replace divide n concure method to dynamic programming.
  • 17. Elements of Dynamic Programming 1. Optimal structure 2. Overlapping subproblem 3. memoization
  • 18. Optimal Structure  This is the necessary property,if this property is not present we cant use dynamic programming.  Say,a problem p,with subproblems p1,p2. Solution of problem p is s,and s1 is the optimum solution of subproblem p1,and s2 is the optimum solution of subproblem p2.  Claim:s is the optimal solution ,if both solution of the subproblems are optimal only then the final solution is optimal.
  • 19. Proof:  the final solution is optimal. only when both solution of the subproblems are optimal  We will proof this by contradiction. Let us take there is a another solution of subproblem p1 s1’which is not optimal.then combining the this solutions s1’ and s2 we get the final solution s’ which takes less number parenthesization than s. But we know s has the optimal number of solution.so s’cant have number of parenthesization less than the number parenthesization than s. So by contradicyion we have prooved that both solution of subproblems are optimal only when the solution of the subproblems are optimal.
  • 20. Some problems where we should not use dynamic programming  Consider the following two problems in which we are given a directed graph G =(V,E)and vertices u,v €V.  Unweighted shortest path:Find a path from u to consisting of the fewest edges. Such a path must be simple, since removing a cycle from a path produces a path with fewer edges.  Unweighted longest simple path: Find a simple path from u to consisting of the most edges.We need to include the requirement of simplicity because otherwise we can traverse a cycle as many times as we like to create paths with an arbitrarily large number of edges.
  • 21. Proof :optimal substructure property holds for unweighted shortest path problem  There are 2 vertices u and v.  P path is optimal if it contains minimum number of vertices.2 subpaths p1[u w] and p2[w->v] if the path is optimal then the subpaths must be optimal. We will proof this by contradiction. Let we have a path p1’between u and w which is not optimal,by combining 2 subpaths we get the final path p’which take less number of vertices than p.but p is optimal.so byy contradiction we have prooved that unweighted shortest path problem follows optimal substructure problem.
  • 22. Proof :optimal substructure property holds for unweighted longest path problem  Longest path betweenA and C: A->B->C  Subpath A->B and B->C should be longest.  Longest path betweenA- >B is: A->C->B  Longest path between B- >C is: B->A->C  It does not follow optimal structure.solution to this problem is not possible yet.