Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Like this presentation? Why not share!

7,871 views

7,410 views

7,410 views

Published on

Published in:
Education

No Downloads

Total views

7,871

On SlideShare

0

From Embeds

0

Number of Embeds

8

Shares

0

Downloads

0

Comments

0

Likes

9

No embeds

No notes for slide

- 1. Elements of Dynamic Programming<br />An Introduction by<br />TafhimUl Islam<br />C091008<br />CSE 4th Semester<br />International Islamic University Chittagong<br />
- 2. What is Dynamic Programming<br />Dynamic Programming (DP) is not an algorithm. It’s a technique/approach that we use to build efficient algorithms for problems of very specific class<br />
- 3. The Elements<br />Optimal Substructure<br />Overlapping sub-problem<br />Memoization<br />
- 4. What is Substructure?<br />A substructure is a structure itself that helps a bigger structure of the same kind to exist.<br />The substructure does not play an auxiliary role<br />It is an essential part of the super structure<br />It is only smaller in size compared to the super structure<br />It has the same properties of the superstructure<br />
- 5. Optimal Substructure<br />So optimal substructure is simply the optimal selection among all the possible substructures that can help a super structure of the same kind to exist<br />Example: To know how to multiply n matrices optimally we must multiply the last matrix with the optimal multiplication result of the n-1 other matrices. The base case for the recursion here is that the optimal parenthesization of <br />
- 6. Optimal Substructure<br />To build a building with the best possible strength, we need to build each level as optimally as possible<br />To solve a mathematical problem, we all the smaller problems inside that problem to have the correct result. Each problem might depend on the previous problem solved. So we need to take care of all the problems optimally, with correct calculations.<br />
- 7. Overlapping Sub-problem<br />Overlapping sub-problem is found in those problems where bigger problems share the same smaller problems. This means, while solving larger problems through their sub-problems we find the same sub-problems in two or more different large problems. In these cases a sub-problem is usually found to be solved previously.<br />
- 8. Overlapping Sub-problem<br />Overlapping sub-problems can be found in Matrix-Chain-Multiplication (MCM) problem. <br />
- 9. Cases where mistakes might occur<br />Unweighted shortest path: Find a path from u to v consisting of the fewest edges. Such a path must be simple, since removing a cycle from a path pro-duces a path with fewer edges.<br />Unweighted longest simple path: Find a simple path from u to v consisting of the most edges. We need to include the requirement of simplicity because other-wise we can traverse a cycle as many times as we like to create paths with an arbitrarily large number of edges.<br />
- 10. Memoizaiton<br />The memoization technique is the method of storing values of solutions to previously solved problems. This generally means storing the values in a data structure that helps us reach them efficiently when the same problems occur during the program’s execution. The data structure can be anything that helps us do that but generally a table is used.<br />

No public clipboards found for this slide

×
### Save the most important slides with Clipping

Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.

Be the first to comment