DynProgEditDistance - Edit Distance The problem of finding...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
The problem of finding an edit distance between two strings is as follows: Given an initial string s, and a target string t, what is the minimum number of chances that have to be applied to s to turn it into t. The list of valid changes are: 1) Inserting a character 2) Deleting a character 3) Changing a character to another character. In initially looking for a recursive solution, you may think that there are simply too many recursive cases. We could insert a character in quite a few locations! (If the string is length n, then we can insert a character in n+1 locations.) However, the key observation that leads to a recursive solution to the problem is that ultimately, the last characters will have to match. So, when matching one word to another, on consider the last characters of strings s and t. If we are lucky enough that they ALREADY match, then we can simply "cancel" and recursively find the edit distance between the two strings left when we delete this character from both strings. Otherwise, we MUST make one of three changes: 1) delete the last character of string s
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 11/09/2009.

Page1 / 4

DynProgEditDistance - Edit Distance The problem of finding...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online