Labs / Computer Science
Edit Distance
Type two words and watch a table fill in from the top-left corner. Each cell asks the same question — what is the cheapest way to turn this prefix into that one? When the grid is full, a path draws itself backward through the winning choices to show the exact edits that connect the two words.
D …filled 0%ops —src —tgt —
What to try
- Where does the final answer — the edit distance — end up sitting in the grid, and why there?
- Drag slowly across one row. Why does each cell only ever look at its up, left, and diagonal neighbours?
- Try two words with the same letters in a different order, like "flaw" and "lawn". Does reordering cost more than you expected?
- When the diagonal neighbour is chosen, what tells you whether it was a free match or a paid substitution?
- Make the two words identical, then change a single letter. How much does the whole grid shift?