Recall & Review
beginner
What is the Edit Distance (Levenshtein distance) between two strings?
It is the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one string into the other.
Click to reveal answer
beginner
Which operations are allowed in calculating Levenshtein distance?
Insertion, deletion, and substitution of a single character.
Click to reveal answer
intermediate
What is the base case when using dynamic programming to compute Levenshtein distance?
When one string is empty, the distance is the length of the other string (all insertions or deletions).
Click to reveal answer
intermediate
How does the dynamic programming table for Levenshtein distance get filled?
Each cell represents the minimum edit distance between prefixes of the two strings, calculated using values from neighboring cells representing smaller prefixes.
Click to reveal answer
beginner
Why is Levenshtein distance useful in real life?
It helps in spell checking, DNA sequence analysis, and natural language processing by measuring how similar two strings are.
Click to reveal answer
Which of the following is NOT an allowed operation in Levenshtein distance?
✗ Incorrect
Levenshtein distance allows insertion, deletion, and substitution, but not transposition (swapping two adjacent characters).
What is the Levenshtein distance between "cat" and "cut"?
✗ Incorrect
Only one substitution (a -> u) is needed, so the distance is 1.
If one string is empty and the other has length 5, what is the Levenshtein distance?
✗ Incorrect
All 5 characters must be inserted or deleted, so the distance is 5.
In dynamic programming for Levenshtein distance, what does each cell in the table represent?
✗ Incorrect
Each cell stores the minimum edit distance between prefixes of the two strings up to that point.
Which real-life application uses Levenshtein distance?
✗ Incorrect
Spell checking uses Levenshtein distance to find words close to a misspelled word.
Explain how dynamic programming helps compute the Levenshtein distance between two strings.
Think about how you compare smaller parts of the strings step by step.
You got /4 concepts.
Describe the three operations allowed in the Edit Distance Problem and how each affects the strings.
Imagine changing one word into another by editing letters.
You got /3 concepts.