|
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
Dynamic
Programming can
|
|
|
|
be
used when:
|
|
|
|
– |
The
goal is to find an
|
|
|
|
optimum
answer among
|
|
|
|
many
possible answers
|
|
|
|
– |
There
is a simple recursive
|
|
|
|
algorithm
that solves the
|
|
|
|
problem,
but it takes too
|
|
|
|
much
time because
|
|
|
|
recursive
calls are repeated
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
Example
applications
|
|
|
|
– |
Matrix-chain
multiplication
|
|
|
|
– |
Longest
common
|
|
|
|
subsequence
|
|
|
|
– |
All-pairs
shortest paths in a
|
|
|
graph
|
|
|
|
– |
Minimum
weight
|
|
|
|
triangulation
of a convex
|
|
|
|
polygon
|
|
|
|
– |
Approximate
string
|
|
|
|
matching
(finding the best
|
|
|
|
match
when deletion and
|
|
|
|
substitution
are allowed)
|
|
|
|