jeffgerickson / algorithms

Bug-tracking for Jeff's algorithms book, notes, etc.
7.92k stars 1.02k forks source link

Edit Distance recurrence Insertion/Deletion #103

Closed ronniedong closed 5 years ago

ronniedong commented 5 years ago

Chapter number or note title: Dynamic Programming

Page number: 110

Error description: If we are editing A="ALGORITHM" to B="ALTRUISTIC", insertion would mean to insert a char at A[i] to match B[j], and the insertion edit distance should be Edit(i, j - 1) + 1; similarly deletion edit distance should be Edit(i - 1, j) + 1

Suggested fix (if any): swap the expressions