jeffgerickson / algorithms

Bug-tracking for Jeff's algorithms book, notes, etc.
7.88k stars 1.02k forks source link

[Oops.] Example Edit Table Transposed in Section 3.7 #266

Open spragunr opened 1 year ago

spragunr commented 1 year ago

Please verify that the error is present in the most recent revision before reporting. Verfied

Chapter number or note title: 3.7 Edit Distance

Page number: 115

Error description: It seems that the rows and columns are swapped in the ALGORITHM/ALTRUISTIC example on page 115. The worked steps in the text make it clear that ALGORITHM is string A and ALTRUISTIC is string B in this example. The figure illustrating evaluation order makes it clear that i is indexing the rows and j is indexing the columns. In the EditDistance algorithm j indexes over B, and i indexes over A. Therefore the column labels should be ALTRUISTIC and the row labels should be ALGORITHM.

Suggested fix (if any): Transpose the edit table on page 115. It may also be helpful to rename A and B to something like FROM and TO.