Errata, Third Printing (August 2009)
CHAPTER 1
p. 15, table
| Printed: | "AB" Hello" "2.5" |
| Fixed: | "AB" "Hello" "2.5" |
p. 39, Exercise 1.2.3
| Printed: | Suppose that a and b are int values. |
| Fixed: | Suppose that a and b are boolean values. |
p. 41, Exercise 1.2.22
| Printed: | x0 + v0t + g t2 / 2 |
| Fixed: | x0 + v0t - g t2 / 2 |
p. 43, Exercise 1.2.29
| Printed: | (14 + 2483 + (31*12) / 12) % 7 = 2500 % 7 = 1 |
| Fixed: | (14 + 2483 + (31*12) / 12) % 7 = 2528 % 7 = 1 |
p. 48
| Printed: | if (x > y) { int t = x; y = x; x = t; } |
| Fixed: | if (x > y) { int t = x; x = y; y = t; } |
p. 50
| Printed: | the statement block is executed five times until the sequence is broken |
| Fixed: | the statement block is executed seven times until the sequence is broken |
p. 81, Exercise 1.3.26
| Printed: | (i <= N/i) instead of (i < N) |
| Fixed: | (i < n) instead of (i <= n/i) |
p. 81, Exercise 1.3.36
| Printed: | double num = 1.0, dem = 1.0; |
| Fixed: | double num = 1.0, den = 1.0; |
p. 92
| Printed: | for (int i = 0; i < suit.length; i++) for (int j = 0; j < rank.length; j++) deck[rank.length*i + j] = rank[i] + " of " + suit[j] |
| Fixed: | for (int i = 0; i < rank.length; i++) for (int j = 0; j < suit.length; j++) deck[suit.length*i + j] = rank[i] + " of " + suit[j] |
p. 98
| Printed: | // Generate random values in (0..N] |
| Fixed: | // Generate random values in [0..N) |
p. 106
| Printed: | the column vector has M entries all equal to 1/M
the row vector has N entries all equal to 1/N |
| Fixed: | the column vector has N entries all equal to 1/N
the row vector has M entries all equal to 1/M |
CHAPTER 2
p. 238
| Printed: | gcd(216, 24) |
| Fixed: | gcd(216, 192) |
p. 236
| Printed: | σ2 = ((x0 - μ)2 + (x1 - μ)2 + ... + (xN-1 - μ)2)) / N-1 |
| Fixed: | σ2 = ((x0 - μ)2 + (x1 - μ)2 + ... + (xN-1 - μ)2) / N-1 |
p. 238
| Printed: | StdStats (Program 2.2.3) |
| Fixed: | StdStats (Program 2.2.4) |
p. 264
| Printed: | see Exercise 2.3.9 |
| Fixed: | see Exercise 2.3.11 |
p. 264
| Printed: | more than 31 years and 1.4 million centuries |
| Fixed: | more than 34 years and 5.8 billion centuries |
p. 279, Exercise 2.3.8
| Printed: | replace + with * |
| Fixed: | replace + with * and return 0 with return 1 |
p. 280, Exercise 2.3.13
| Printed: | log2 N |
| Fixed: | 2 log2 N + 1 |
p. 308, Exercise 2.4.1
| Printed: | refers to Exercises 1.4.13, 1.4.25, and 1.4.33 |
| Fixed: | should refer to Exercises 1.4.14, 1.4.26, and 1.4.37 |
p. 308, Exercise 2.4.5
| Printed: | recursive show() method |
| Fixed: | recursive flow() method |
CHAPTER 3
p. 335, Program 3.1.6
| Printed: | // Compute blend of c and d, weighted by x |
| Fixed: | // Compute blend of c and d, weighted by alpha |
p. 342, Program 3.1.8
| Printed: | if ((codon.equals(stop)) && beg != -1) |
| Fixed: | if ((codon.equals(stop)) && beg != -1 && beg + 3 < i) |
p. 348
| Printed: | See the Context section at the end of this book for some details about this language. |
| Fixed: | Remove reference to HTML in Context. |
p. 349
| Printed: | print one line per column, with commas separating row entries |
| Fixed: | print one line per row, with commas separating column entries |
p. 350
| Printed: | java Split DJIA 3 |
| Fixed: | java Split DJIA 4 |
p. 391
| Printed: | Complex (Program 3.2.2) |
| Fixed: | Complex (Program 3.2.6) |
p. 397
| Printed: | int t = 512 - mand(z0, 512); |
| Fixed: | int t = 255 - mand(z0, 255); |
p. 411
| Printed: | a[i]. change(-2); |
| Fixed: | a[i]. increaseCharge(-2); |
p. 421
| Printed: | Program 3.2.5 (twice) |
| Fixed: | Program 3.2.6 (twice) |
p. 460
| Printed: | Vector delta = a.r.minus(b.r) |
| Fixed: | Vector delta = b.r.minus(a.r) |
CHAPTER 4
p. 482
| Printed: | NBody |
| Fixed: | Universe |
p. 513
| Printed: | T(1) = 1 |
| Fixed: | T(1) = 0 |
p. 529, mergesort trace
| Printed: | the |
| Fixed: | his |
p. 531
| Printed: | StdStats.select() |
| Fixed: | StdStats.median() |
p. 607, Exercise 4.3.49
| Printed: | no base case in recursive reverse() |
| Fixed: | if (first == null || first.next == null) return first; |
p. 646, Exercise 4.4.52
| Printed: | void get(int i) |
| Fixed: | char get(int i) |
