The University of Texas at Austin
Lecture 8
Department of Computer Sciences
Professor Vijaya Ramachandran
Dynamic Programming
CS357: ALGORITHMS, Spring 2006
1
Dynamic Programming
In this lecture we will study an algorithmic technique called ‘dynamic programming’.
Dynamic programming
and the
greedy
strategy that we will study later solve ‘optimization’
problems. An
optimization problem
is one for which an input has a collection of
feasible
solutions, each with an associated cost, and we need to ﬁnd a feasible solution that
optimizes
the cost; here ‘optimizes’ would mean either
minimizes
or
maximizes
, depending on the
nature of the problem. Such a solution is called an
optimal solution.
We will now study a dynamic programming algorithm for the
Longest Common Subsequence
(LCS)
problem.
1.1
Longest Common Subsequence Problem
A sequence
Z
=
<z
1
,
···
,z
k
>
is a
subsequence
of another sequence
X
=
<x
1
,
···
,x
m
>
if there exists a strictly increasing sequence of indices 1
≤
i
1
<i
2
···
<i
k
≤
m
such that
x
i
j
=
z
j
,1
≤
j
≤
k
.
Given sequences
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '06
 Ramachandran
 Algorithms, Dynamic Programming, C Programming, Optimization, Recurrence relation, Longest common subsequence problem, ZL

Click to edit the document details