Minimum edit distance algorithm II
In this blog, we will demonstrate how to populate the previously mentioned table, which is used to convert one word into another, using code. By the conclusion of this blog, you will be presented with the final product. Previously, an intuitive method was employed to complete the upper left corner of the minimum edit distance table. Now, let me demonstrate how to apply a formulaic method to complete the remainder.

So you filled out some of the table already and it looks like this. Now, to fill out the rest of the table,
Before you do anything else, make sure to fill in all the cells in the left column and top row. And if you want to turn a play into empty string, just delete all the letters. You can fill out these cells top to bottom by following this formula.
For each cell, look at the cell above and at the cost of an extra delete edit, which will be 1. So, basically, all you have to do to turn the string p into an empty string is to one delete operation. As demonstrated in the previous example, to convert the string containing 'p, l' into an empty string, one must delete 'p' and then delete 'l'. These are two deletion operations, and so forth.
At D[4,0], the minimum edit distance for converting 'play' to an empty string is simply the cost of four deletions, which is 4.

The concept from the first row can be applied by transforming an empty string into 'stay' by inserting one letter sequentially. This can be achieved by using a slightly different formula. Working from left to right, observe the preceding cell and add an additional insert cost of one.

In the previous example, the method to calculate this cell without using formulas was demonstrated. However, the solution can also be determined by using big,scary-looking formula. It builds upon the computations you've already made in just the same way as using the no formula method.
The distance to the orange cell will be the shortest distance to reach it from any of the .At first glance, it may appear somewhat abstract, but it can be deconstructed into more manageable segments..
For instance, if you're moving from the cell above, you would incur a deletion cost. just like you did in the first column.
If you move from the cell to the left, you will incur an insertion cost, similar to what was applied in the top row.
When moving from the cell to the upper left, you will take one of two actions. If the two letters, source i and target j, are different, you will add a replacement cost. If they match, you add nothing, as no edit is required for letters that are the same.

So here for this cell you have the minimum of 1 + 1 which is 2. Another 1 + 1 which is 2. Since these two letters don't match, you have 0 plus 2 which is also 2. Then, take the minimum value from these three, which is 2 in this instance, and enter it into the cell. This is the minimum edit distance from 'p' to 's' using the defined formula and costs. You can complete the rest of the table in the same manner.

The m, n entry in the bottom right corner represents the minimum edit distance from 'play' to 'stay', which is 4.

Color coding or a heat map can indeed reveal intriguing patterns. Observe the transition from the middle square. Correct, once the change from 'p, l' to 's, d' is made, the suffixes of both words become identical, 'a, y,' eliminating the need for further edits. This is why the number 4 continues along the diagonal.
