What information entered the process?
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.
Labs / Computer Science / Edit Distance
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.
Why it matters
Why explore this?
Computer science turns clear rules into reliable processes. This model lets you step through those rules and see how each decision changes the result.
Explore
Try the model
Investigate
Questions to test
Predict first, try it in the model, then use what you observe to answer.
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?
Explain
Make sense of what happened
Trace the process one step at a time. Name the rule used at each important step, then explain why the final result follows from those rules.
Check
Before you leave
Which rule changed it?
Why did the process produce this result?
If you can answer all three using evidence from the model, you understand the main idea. If not, return to Explore and change one setting at a time.