Understanding the top down solution to the edit distance problem


To solve the edit distance problem using a top-down dynamic programming approach, we implement the recurrence relation directly using recursion, while storing previously computed results in a memoization table.

The top down solution

As with any top-down solution, there is a recursive function that solves subproblems and a calling function that initializes the required data structures and triggers the computation.

Liking the course? Check our discounted plans to continue learning.