jeffgerickson / algorithms

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

[Oops.] Error in Longest Path in DAGs Algorithm #192

Open nielstron opened 4 years ago

nielstron commented 4 years ago

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

Chapter number or note title: 6.4 Memoization and Dynamic Programming

Page number: 236

Error description: The indentation of the last line in the Longest Path Algorithm is probably wrong. In the current version, the algorithm only returns something when either v=t or v.LLP is undefined.

image

Suggested fix (if any): It should return v.LLP per default, by reducing the indentation of the last line by one