Three neighbours
transcript
A store compares two words. It needs the fewest edits. A table finds the answer. Each cell reads three neighbours.
The cell above is a delete. The cell to the left is an insert. The diagonal is a replace.
Each cell reads three cells. All three are filled before it. So the table fills row by row.
The first row counts inserts. The first column counts deletes. Letters l and m differ. Take one plus the smallest. Letters e and e are equal. Copy the diagonal. Letters m and l differ. One plus the smallest again.
Equal letters need no edit. So copy the diagonal cell. Different letters need one edit. Add one to the smallest of three.
Pick any cell of the table. Find the two letters it compares. Apply the rule by hand.
Delete, insert, replace: above, left, diagonal. Fill row by row. Full breakdown in the lecture.