jeffgerickson / algorithms

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

Chap 3.9, p 117 issue in the following lines from FASTSUBSETSUM #246

Open hlyang1992 opened 3 years ago

hlyang1992 commented 3 years ago

Chap 3.9, p 117 issue in the following lines from FASTSUBSETSUM,

for t <- 1 to X[i] - 1
    S[i, t] <- S[i+1, t]
for t <- X[i] to T
    S[i, t]...

But it should be,

if t < X[i]
    S[i, t] <- S[i+1, t]
else
    S[i, t]...

Because X[i] > T in some cases.