## Dynamic Programming

 LA home Computing Algorithms  glossary  Dynamic Prog.   Edit dist.   Hirschberg's  Graphs

Dynamic Programming refers to a very large class of algorithms. The idea is to break a large problem down (if possible) into incremental steps so that, at any given stage, optimal solutions are known to sub-problems. When the technique is applicable, this condition can be extended incrementally without having to alter previously computed optimal solutions to subproblems. Eventually the condition applies to all of the data and, if the formulation is correct, this together with the fact that nothing remains untreated gives the desired answer to the complete problem.

It is often the case in D.P. that the intermediate desirable condition implies more than seems to be strictly needed for the final answer. For example, the linear-time Fibonacci function, recursive or iterative, could be said to be a DPA. It holds (at least) two values, fib(i-1) and fib(i). When `i' gets to `n', only one of these values is needed, fib(i)=fib(n). However it is possession of the two values that allows the linear-time algorithm.

Examples of dynamic programming include

• [edit-distance], longest common subsequence, spelling correction, and similar problems on strings; also Hirschberg's space-efficient [version], a functional programming [version] and
a longest common subsequence (LCS) (LCSS), algorithm using bit operations for speed-up [HTML],
• shortest path algorithms on [graphs],
• [segmentation] of a time series,
• some [spanning-tree] algorithms.