jeffgerickson / algorithms

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

[Oops.]Maybe off-by-one problem in Chapter1.Exercises.1.(d) #282

Closed St1ng-Ray closed 7 months ago

St1ng-Ray commented 7 months ago

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

Chapter number or note title: Chapter 1

Page number: 45

Error description: in the (d) algorithm, $\rho(i)$ will never equals to 0, so disk 0 won't move

Suggested fix (if any): while statement condition should be $\rho(i)-1$

Not sure if I misunderstand how $\rho(i)$ works

St1ng-Ray commented 7 months ago

Sorry for bothering, I've figured it out