Edit distance

Contents

Definition

The edit distance of two strings is the minimum number of atomic edtion operations (insertion, deletion or substitution of characters) that must be done in order to transform one string in the other.

Also known as Levenshtein distance.

Examples

EditDist('house','')= 5, (removing all the characters)
EditDist('house','houses')=1, (inserting an 's' at the end of the first string)
EditDist('house','horses')=2, (changing the 'u' in the first string by 'r' and inserting an 's' at the end)
EditDist('boulevard','blvd')=5, (removing 'o', 'u', 'e', 'a' and 'r' from de first string).