Post date: Nov 15, 2013 1:44:51 PM
< Previous-Greedy Technique Next - Introduction to Graphs>
Dynamic Programming Technique is similar to divide-and-conquer technique. Both techniques solve a problem by breaking it down into several sub-problems that can be solved recursively. The main difference between is that, Divide & Conquer approach partitions the problems into independent sub-problems, solve the sub-problems recursively, and then combine their solutions to solve the original problems. Where as dynamic programming is applicable when the sub-problems are not independent, that is, when sub-problems share subsubproblems. Also A dynamic programming algorithms solves every sub problem just once and then saves its answer in a table, there by avoiding the work of recomputing the answer every time the subsubproblems is encountered.
Therefore "Dynamic programming is a applicable when sub problem are not independent ,that is,when sub problem share sub problems."
As Greedy approach, Dynamic programming is typically applied to optimization problems and for them there can be many possible solutions and the requirement is to find the optimal solution among those. But, Dynamic programming approach is little different greedy approach. In greedy solutions are computed by making choices in serial forward way and in this no backtracking & revision of choices is done where as Dynamic programming computes its solution bottom up by producing them from smaller sub problems, and by trying many possibilities and choices before it arrives at the optimal set of choices.
The Development of a dynamic-programming algorithm can be broken into a sequence of four steps:
Now for any problem to be solved through dynamic programming approach it must follow the following conditions:
Various algorithms which make use of Dynamic programming technique are as follows: