Data Structures & AlgorithmsVery hardGATE CS · ICPC regional
Using unit-cost insertions, deletions and substitutions, what is the minimum number of operations needed to turn the string 'bcacba' into 'acbbbbc'?
- A. 7
- B. 3
- C. 5
- D. 4
Correct answer: C. 5
This is the Levenshtein (edit) distance, computed by the standard DP. A substitution costs one operation, so the insert-and-delete-only distance n + m − 2·LCS is larger whenever a substitution helps.
Practise more Trees, Graphs, Recursion and Dynamic Programming questionsTrees, Graphs, Recursion and Dynamic Programming: notes and key points
More Trees, Graphs, Recursion and Dynamic Programming questions
- Using unit-cost insertions, deletions and substitutions, what is the minimum number of operations needed to turn the string 'bcccb' into…
- Using unit-cost insertions, deletions and substitutions, what is the minimum number of operations needed to turn the string 'bbabaac' into…
- Using unit-cost insertions, deletions and substitutions, what is the minimum number of operations needed to turn the string 'bbbc' into…
- Using unit-cost insertions, deletions and substitutions, what is the minimum number of operations needed to turn the string 'bccacbb' into…
- Using unit-cost insertions, deletions and substitutions, what is the minimum number of operations needed to turn the string 'aabcb' into…
- Using unit-cost insertions, deletions and substitutions, what is the minimum number of operations needed to turn the string 'bccbba' into…