![]() Characterize the structure of an optimal solution.Ģ. ![]() The development of a dynamic-programming algorithm can be broken into a sequence of four steps.ġ. ![]() We call such a solution an optimal solution to the problem, as opposed to the optimal solution, since there may be several solutions that achieve the optimal value. Each solution has a value, and we wish to find a solution with the optimal (minimum or maximum) value. In such problems there can be many possible solutions. A dynamic-programming algorithm solves every subsubproblem just once and then saves its answer in a table, thereby avoiding the work of recomputing the answer every time the subsubproblem is encountered.ĭynamic programming is typically applied to optimization problems. In this context, a divide-and-conquer algorithm does more work than necessary, repeatedly solving the common subsubproblems. ![]() In contrast, dynamic programming is applicable when the subproblems are not independent, that is, when subproblems share subsubproblems. ("Programming" in this context refers to a tabular method, not to writing computer code.) As we saw in Chapter 1, divide-and-conquer algorithms partition the problem into independent subproblems, solve the subproblems recursively, and then combine their solutions to solve the original problem. Intro to Algorithms: CHAPTER 16: DYNAMIC PROGRAMMING CHAPTER 16: DYNAMIC PROGRAMMINGĭynamic programming, like the divide-and-conquer method, solves problems by combining the solutions to subproblems.
0 Comments
Leave a Reply. |