View the step-by-step solution to:


This question was created from homework1


Exercise 5 (20 points): In class we have defined the Edit Distance between two strings x and y, of
length n and m respectively to be the minimum (weighted) number of insertions, deletions and substitutions
that transform string x to string y. We also demonstrated that assuming different deletion, insertion
and substitution costs for every letter (or pairs of letters), the following dynamic-programming recursion
computes the edit distance between x and y:
D(x(1 . ..i - 1), y(1 . . .j)) + delete(x[i]),
D(x(1 . . .i), y(1 . . . j)) = min D(x(1. . .i), y(1. ..j -1)) + insert(y[j]),
D(x(1 . ..i - 1), y(1 . ..j - 1)) + substitute(x[i], y[j]).
In the above equation x(1. ..i) (resp. y(1. ..j)) is the substring of x (resp. of y) that consists of the first
i (resp. j) symbols appearing in x (resp. y). Also, for symbol a, delete(a), insert(a) correspond to the
cost of deleting or inserting a respecti vely. Finally, for symbols a, b, substitute(a, b) corresponds to the
cost of substituting symbol a with symbol b.
1. (10 points:) Prove or disprove that the edit distance function as defined above is a metric.
2. (10 points:) Find two instantiations of the edit-distance function that are metrics. An instantiation of
the edit distance function is defined by a specific way of allocating costs to operations such as deletions,
insertions and substitutions.

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes