stevenhalim / cpbook-code

CP4 Free Source Code Project (C++17, Java11, Python3 and OCaml)
1.99k stars 491 forks source link

Error found in CP4 Book 1 #80

Open jtbergman opened 3 years ago

jtbergman commented 3 years ago

Hi,

I couldn't find where to submit errors found in the book. I recently bought CP4 Book 1 and in the example for Max 2D Range Sum I believe there is an error in the cumulative array sum on page 175, table 3.3, figure b.

Original Array

 0 -2 -7  0
 9  2 -6  2
-4  1 -4  1
-1  8  0 -2

Cumulative Sum Array (In Book)

 0 -2 -9 -9 
 9  9 -4  2
 ...

I believe A[1][3] should be -2 and not 2.

Thanks! JT

stevenhalim commented 3 years ago

Hi JT Bergman

Ok, I have just checked this and realized that you are right. So page 175, table 3.3, figure B and C (C affected too), cell A[1][3] should be -2 indeed. I have updated the errata page at https://cpbook.net. Thanks for catching this bug (apparently already there since CP3 7 years ago)

[image: image.png]

Regards,

Steven Halim (Dr.) Senior Lecturer School of Computing, National University of Singapore http://www.comp.nus.edu.sg/~stevenha IOI 2020 (https://ioi2020.sg/) and 2021 (http://ioi2021.sg/) Deputy Director+IC Member https://visualgo.net and https://cpbook.net (CP4 is out)

On Tue, Oct 13, 2020 at 8:51 PM JT Bergman notifications@github.com wrote:

Hi,

I couldn't find where to submit errors found in the book. I recently bought CP4 Book 1 and in the example for Max 2D Range Sum I believe there is an error in the cumulative array sum on page 175, table 3.3, figure b.

Original Array

0 -2 -7 0 9 2 -6 2 -4 1 -4 1 -1 8 0 -2

Cumulative Sum Array (In Book)

0 -2 -9 -9 9 9 -4 2 ...

I believe A[1][3] should be -2 and not 2.

Thanks! JT

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/stevenhalim/cpbook-code/issues/80, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABIDWOEW7QQ72XSCX2BD4FTSKREL3ANCNFSM4SOZRWLQ .