Fall 11: CSci 5421—Advanced Algorithms and Data Structures
Out 9/21
Homework 2
Due 10/10
Please do all problems; we will grade a subset of three to four problems. Any Exercise/Problem
numbers refer to the 3rd edition
of the text. (Corresponding numbers for the second edition are
given, where available, in parentheses.) Please follow all of the instructions given in the handout
for Homework 1.
1.
(9 points) Ex. 15.25, p. 378. (Ex. 15.24, p. 338 in the 2nd edition.)
2.
(12 points) Give a
topdown, memoized
version of the algorithm
LCSLength
(
X, Y
) to compute,
in
O
(
mn
) time, the length of a longest common subsequence of strings
X
and
Y
, where
m
=

X

and
n
=

Y

. (You do not have to retrieve the LCS itself; just compute its length.) Give a
careful
analysis of the running time.
3.
(15 points) Consider the problem of transforming a string, A, of characters into another string,
B, by a sequence of
insert
(I),
delete
(D), and
substitute
(S) operations. For instance, the string
unix
can be transformed to
mutiny
, as follows: (Here M denotes the nonoperation of simply matching
two identical characters.)
IMDIMIS
< operations
A: un i x
B: mu tiny
That is, we insert an
m
, match the two
u
’s, delete the
n
, insert a
t
, match the two
i
’s, insert an
n
,
and substitute
x
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.
 Fall '08
 Sturtivant,C
 Algorithms, Dynamic Programming, Data Structures, dynamic programming algorithm, edit distance, Greedy choice property, bottomup dynamic programming

Click to edit the document details