Computer Science C73
October 24 2007
Scarborough Campus
University of Toronto
Homework Assignment #3
Due: November 7 2007, by 12 noon
(in the course drop box)
Appended to this document is a cover page for your assignment. Fill it out, staple your answers to it,
and deposit the resulting document into the course drop box. Please do
not
enclose your assignment in
an envelope.
Question 1.
(10 marks)
Recall the dynamic programming algorithm to compute the edit distance of two
strings discussed in class (and in KT 6.7). Suppose the two input strings are “SNOOP” and “LOOPY”.
a.
Show the twodimensional array of values computed by the algorithm when finding the edit distance
of these strings.
b.
Draw the DAG of subproblems solved in this example, and label each edge with 1 (if it corresponds
to extending an alignment by inserting, deleting, or changing a letter), or 0 (if it corresponds to extending
an alignment by matching letters).
Identify a shortest path in this DAG from the node corresponding
to the smallest subproblem solved (computing the edit distance between the empty string and the empty
string) to the node corresponding to the largest subproblem solved (computing the edit distance between
“SNOOP” and “LOOPY”).
c.
Suppose we want to output a shortest sequence of editing operations (of the form insert X, delete X,
or change X to Y, where X and Y are letters) that transforms the first string to the second. Explain how
this sequence can be derived from the shortest path that you identified in part (b).
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 '08
 Pearly
 Dynamic Programming, shortest path, dynamic programming algorithm, Knapsack problem, positive integers w1

Click to edit the document details