Errata, Chapter 1
p. 38
| Printed: | 10^6 not 100000 but 12 |
| Fixed: | 10^6 not 1000000 but 12 |
p. 47
| Printed: | if (x > y) { int t = x; y = x; x = t; } |
| Fixed: | if (x > y) { int t = y; y = x; x = t; } |
p. 72, figure
| Printed: | 4th Hello 4th Hello 4th Hello |
| Fixed: | 4th Hello 5th Hello 6th Hello |
p. 73, figure
| Printed: | EightHellos, DivisorsPattern, Newton, Factor |
| Fixed: | TenHellos, DivisorPattern, Sqrt, Factors |
p. 77, Exercise 1.3.2
| Printed: | Exercise 1.3.3 |
| Fixed: | Exercise 1.2.3 |
p. 79, Exercise 1.3.17
| Printed: | 1 - f(t) / f'(t) |
| Fixed: | t - f(t) / f'(t) |
p. 91
| Printed: | "2", "3", "4", "5", "6", "7", "8", "9", "10" "Jack", Queen", "King", "Ace" |
| Fixed: | "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King", "Ace" |
p. 94, Program 1.4.1
| Printed: | perm[j] = t; |
| Fixed: | perm[i] = t; |
p. 95
| Printed: | the values of N and M are 16 and 5 |
| Fixed: | the values of N and M are 16 and 6 |
p. 100, Program 1.4.3
| Printed: | for (int i = 2; i < N; i++) |
| Fixed: | for (int i = 2; i <=N; i++) |
p. 100
| Printed: | % java PrimeSieve 17 |
| Fixed: | % java PrimeSieve 25 |
p. 104 and p. 106 figures
| Printed: | for (int j = 0; j < N; i++) |
| Fixed: | for (int j = 0; j < N; j++) |
p. 109
| Printed: | if (r < 0.25 && !a[x+1][y]) x++; else if (r < 0.50 && !a[x-1][y]) x--; else if (r < 0.75 && !a[x][y+1]) y++; else if (r < 1.00 && !a[x][y-1]) y--; |
| Fixed: | if (r < 0.25) { if (!a[x+1][y]) x++; } else if (r < 0.50) { if (!a[x-1][y]) x--; } else if (r < 0.75) { if (!a[x][y+1]) y++; } else if (r < 1.00) { if (!a[x][y-1]) y--; } |
p. 113, Exercise 1.4.7
| Printed: | System.out.println(i) |
| Fixed: | System.out.println(a[i]) |
p. 116, Exercise 1.4.20
| Printed: | The value dist[i] |
| Fixed: | The value dist[k] |
p. 149
| Printed: | 4410000/44100 |
| Fixed: | 441000/44100 |
p. 149
| Printed: | void double[] read(String file) |
| Fixed: | double[] read(String file) |
p. 164
| Printed: | multiply outDegree[i][j] by .90 / degree[i] |
| Fixed: | multiply count[i][j] by .90 / outDegree[i] |
p. 165, variable description box
| Printed: | outDegree[j] |
| Fixed: | outDegree[i] |
p. 165
| Printed: | StdOut.println(N + " " N) |
| Fixed: | StdOut.println(N + " " + N) |
p. 171
| Printed: | (.02 * .02) + (.02 + .32) + (.32 * .02) + (.32 * .02) + (.32 * .47) = .17 |
| Fixed: | (.02 * .02) + (.02 + .38) + (.38 * .02) + (.38 * .02) + (.20 * .47) = .12 |
