dynamic programmng2

Click here to load reader

Upload: debolina13

Post on 10-Jun-2015

462 views

Category:

Engineering


0 download

DESCRIPTION

analysis and design algorithms: dynamic programming lecture 2

TRANSCRIPT

  • 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]v] if the path is optimal then the subpaths must be optimal. We will proof this by contradiction. Let we have a path p1between u and w which is not optimal,by combining 2 subpaths we get the final path pwhich 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.