A number of errors and typos in the first and second printing of the book were corrected in the third printing. The printing number of a book is the first number listed on the bottom of the copyright page.
Chapter | Page | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 5 | Octal constants can begin with 00 (tm) | ||||||||||||||||||||||||||||||||||||
1 | 11 | booleans can also be used as switch values (tm) | ||||||||||||||||||||||||||||||||||||
2 | 32 | comment, rand return => rand returns (es) | ||||||||||||||||||||||||||||||||||||
2 | 35 | last word, taking=>talking (jab) | ||||||||||||||||||||||||||||||||||||
2 | 38 | "seven of" -> "7 of" (twice) (mc) | ||||||||||||||||||||||||||||||||||||
2 | 40 | A data field (=>member function) ... is called a mutator (ap) | ||||||||||||||||||||||||||||||||||||
3 | 47 | in recipe, yokes should be yolks (tm) | ||||||||||||||||||||||||||||||||||||
3 | 52 | comment in wrong font (pl) | ||||||||||||||||||||||||||||||||||||
3 | 59 | comment in wrong font (es) | ||||||||||||||||||||||||||||||||||||
4 | 67 | Assert need only check > 0, and loop can begin at 1(mc) | ||||||||||||||||||||||||||||||||||||
4 | 69 | 2nd for statement indented wrong (jv) | ||||||||||||||||||||||||||||||||||||
4 | 70 | 6th par, (n-1)n is n2-n, not n2+n (em) | ||||||||||||||||||||||||||||||||||||
4 | 76 | m[i,j] should be m[i][j] (lz) | ||||||||||||||||||||||||||||||||||||
4 | 77 | Misspelling, Logarithmic (nk) | ||||||||||||||||||||||||||||||||||||
4 | 77 | discussion of drop, see footnote, (nk) | ||||||||||||||||||||||||||||||||||||
6 | 113 | if true => if yes (es) | ||||||||||||||||||||||||||||||||||||
6 | 118 | 2nd line, Figure 9.1 should refer to Figure 9.2 (tm) | ||||||||||||||||||||||||||||||||||||
7 | 129 | body of loop isn't indented (mc) | ||||||||||||||||||||||||||||||||||||
7 | 130 | initializing smallest wrong (see footnote) (db) | ||||||||||||||||||||||||||||||||||||
7 | 136 | arguments to count function (footnote)(jtk) | ||||||||||||||||||||||||||||||||||||
7 | 137 | become true => become false (js) | ||||||||||||||||||||||||||||||||||||
7 | 138 | find(string&,int)=>find(string&, unsigned int) (lnz) | ||||||||||||||||||||||||||||||||||||
7 | 143 | bug: resize doesn't always pad properly (footnote) (tm) | ||||||||||||||||||||||||||||||||||||
7 | 147 | respectfully should be respectively (mo) | ||||||||||||||||||||||||||||||||||||
7 | 148 | first loop in insert should use greater-equal | ||||||||||||||||||||||||||||||||||||
7 | 150 | comps should nowdays return bool, not int | ||||||||||||||||||||||||||||||||||||
8 | 155 | 2nd par, missing ``of'' in number fundamental (jtk and dk) | ||||||||||||||||||||||||||||||||||||
8 | 160 | less than 20 => less than 21 (kz) | ||||||||||||||||||||||||||||||||||||
8 | 160 | not be eliminate, be=>been (jtk) | ||||||||||||||||||||||||||||||||||||
8 | 162 | indentation on last if statement wrong (jtk) | ||||||||||||||||||||||||||||||||||||
8 | 162 | arguments to swap incorrect (jtk) | ||||||||||||||||||||||||||||||||||||
8 | 166 | 2nd par, 2nd sentence, each is, not each are (jtk) | ||||||||||||||||||||||||||||||||||||
8 | 170 | swap is O(1), not O(n) (pl) | ||||||||||||||||||||||||||||||||||||
8 | 170 | Insert places element before iterator, not after. | ||||||||||||||||||||||||||||||||||||
8 | 174 | Count returns value (footnote) (jtk) | ||||||||||||||||||||||||||||||||||||
8 | 175 | 1st par, not only is count not a member function, args are wrong (footnote)(jtk) | ||||||||||||||||||||||||||||||||||||
8 | 177 | tilde missing on destructor(mc) | ||||||||||||||||||||||||||||||||||||
8 | 177 | 1st par, differences are, not differences is (jtk) | ||||||||||||||||||||||||||||||||||||
8 | 178 | copy constructor, v.length() should be v.size() (kv) | ||||||||||||||||||||||||||||||||||||
8 | 180 | bottom, should use ++current, not current++ (tm) | ||||||||||||||||||||||||||||||||||||
8 | 181 | code won't compile (footnote) (kz) | ||||||||||||||||||||||||||||||||||||
9 | 191 | 2nd par, 2nd sen, missing word "either of the" (mo) | ||||||||||||||||||||||||||||||||||||
9 | 192 | inserter places elements prior to location specified by iterator | ||||||||||||||||||||||||||||||||||||
9 | 193 | box at top should be id_number, to match text at bottom (tm,gf) | ||||||||||||||||||||||||||||||||||||
9 | 196 | Code does not work as advertised, see footnote (jb) | ||||||||||||||||||||||||||||||||||||
9 | 197 | constructor should set max, not size (ok) | ||||||||||||||||||||||||||||||||||||
9 | 198 | missing colon in constructor, 15th line from bottom (gf) | ||||||||||||||||||||||||||||||||||||
9 | 199 | some compilers object to variables having same name as classes (e.g., course) (sg) | ||||||||||||||||||||||||||||||||||||
9 | 202 | add ::iterator to declarations for c_start, c_end, etc. (tm) | ||||||||||||||||||||||||||||||||||||
9 | 202 | 8 lines from bottom, s_end should be s_stop (sg) | ||||||||||||||||||||||||||||||||||||
9 | 203 | missing colon in constructor(kv) | ||||||||||||||||||||||||||||||||||||
9 | 203 | 2nd arg in insert should be T& (kv) | ||||||||||||||||||||||||||||||||||||
9 | 204 | missing colon in constructor(kv) | ||||||||||||||||||||||||||||||||||||
9 | 206 | firstlink => firstLink (mo) | ||||||||||||||||||||||||||||||||||||
9 | 207 | implementation of prefix and postfix operators reversed (tm) | ||||||||||||||||||||||||||||||||||||
9 | 207 | return this should be dereferenced (kv) | ||||||||||||||||||||||||||||||||||||
9 | 208 | use of terms preorder and postorder should be prefix, etc (nk) | ||||||||||||||||||||||||||||||||||||
9 | 208 | new link needs template argument (kv) | ||||||||||||||||||||||||||||||||||||
9 | 208 | itr->currentlink should use period (also in erase) (kv) | ||||||||||||||||||||||||||||||||||||
9 | 210 | remove by-ref from argument to add | ||||||||||||||||||||||||||||||||||||
9 | 212 | (bottom) private members can also be accessed by friends (tm) | ||||||||||||||||||||||||||||||||||||
10 | 220 | template arguments for stack (see footnote) (jtk) | ||||||||||||||||||||||||||||||||||||
10 | 225 | Line -12, has precedence less than or equal to the top, code doesn't handle same priorities well (see footnote) (jtk) | ||||||||||||||||||||||||||||||||||||
10 | 226 | Some systems confuse plus with function of same name, rename enum values as plusOp, etc. | ||||||||||||||||||||||||||||||||||||
10 | 229 | randomizer(6) should be randomizer(7) (tm) | ||||||||||||||||||||||||||||||||||||
10 | 229 | method done, should be <= not < (mo) | ||||||||||||||||||||||||||||||||||||
10 | 233 | destructer does not delete last node (tm) | ||||||||||||||||||||||||||||||||||||
11 | 243 | previousRow should be declared with numColumns entries (mc) | ||||||||||||||||||||||||||||||||||||
11 | 247 | mid page, The DFS is still looking, DFS=>BFS (pr) | ||||||||||||||||||||||||||||||||||||
11 | 257 | Figure in middle of code, unfortunate page break (pr) | ||||||||||||||||||||||||||||||||||||
11 | 259 | subscript operator, test should be less than, not lt-equal, (mo) | ||||||||||||||||||||||||||||||||||||
11 | 260 | confusion with type signitures on prefix and postfix increments (see page 207) (nk) | ||||||||||||||||||||||||||||||||||||
12 | 267 | data should be unsigned, not int (footnote 3) (jp) | ||||||||||||||||||||||||||||||||||||
12 | 271 | variable max conflicts with function on some systems, rename as maxValue | ||||||||||||||||||||||||||||||||||||
12 | 272 | The implementation is correct (see footnote 4) (jp) | ||||||||||||||||||||||||||||||||||||
12 | 275 | swap and next line indented wrong (jp) | ||||||||||||||||||||||||||||||||||||
12 | 276 | word should be passed by value, since it is modified (jp) | ||||||||||||||||||||||||||||||||||||
12 | 278 | exceed should be equal or exceed (2nd to last line) (jp) | ||||||||||||||||||||||||||||||||||||
12 | 281 | recall that a list ... held a pointer to first element. (however, the list described has pointer also to end) (jp) | ||||||||||||||||||||||||||||||||||||
12 | 283 | lefthChild.size() should be leftChild->size() (same for right) (kv) | ||||||||||||||||||||||||||||||||||||
12 | 284 | condtional test bottom of page 284 should be removed (mo) | ||||||||||||||||||||||||||||||||||||
12 | 286 | node::insert, newElement should be newNode->value (kv) | ||||||||||||||||||||||||||||||||||||
12 | 288 | in result, should test if (rest) result->parent = pa (kv) | ||||||||||||||||||||||||||||||||||||
13 | 302 | symbol n used for two different purposes (see footnote) | ||||||||||||||||||||||||||||||||||||
13 | 308 | doBinary, code needs to set parent pointers (kz) | ||||||||||||||||||||||||||||||||||||
13 | 310 | (also page 311) isEmpty() => empty() (ms) | ||||||||||||||||||||||||||||||||||||
13 | 311 | pop the LEFT paren, and from operatorStack, not operandStack (es) | ||||||||||||||||||||||||||||||||||||
13 | 312 | node methods left() and right() should be leftChild and rightChild (kv) | ||||||||||||||||||||||||||||||||||||
13 | 315 | postorder traversal initialization not right (see footnote) (kz) | ||||||||||||||||||||||||||||||||||||
13 | 325 | Exercise 14, left nodes=>leaf nodes (mo) | ||||||||||||||||||||||||||||||||||||
14 | 346 | Line -8, multiset14 | 350 | Code, pivotPosition and pivotIndex should be same variable (jc)
| 14 | 353 | quicksort, last argument should be numberElements, not number?Elements-1
(pr)
| 15 | 368 | heapsize => heapSize (ta)
| 16 | 404 | 2nd last sentence, missing word, generating THE concordance (nk)
| 17 | 412 | hash function missing mod reduction (pr)
| 17 | 420 | penultimate sentence, value sort should be count sort (from page 416) (mo)
| 18 | 431 | Fig 18.1 inner loop should increment k (rl)
| 18 | 434 | numberOfRows should not be initializer (see note) (rl)
| 18 | 434 | Missing parens following numberOfRows (th), also cost should be costs
| 18 | 435 | mid page, variable name should be quantity (see page 432), also cost should be costs (rl)
| B | 504 | string comparison should be ==, not = (mo)
| B | 515 | 2nd prototype, stop2 => stop1 (jb)
| |
Smith,Amy A Jones,Randy B Smith,Amy BSince Amy will be processed entirely before randy, she will get both courses A and B, and poor Randy will get nothing. The fix, unfortunately, eliminates some of features that make this a good illustration of generic algorithms in the STL.
int Precedence (const operators &myOp) { if (myOp==leftparent) return 1 else if (myOp==plusOp || muOp==minusOp) return 2 else if (myOp==multiplyOp || muyOp==divideOp) return 3 }then inside the function processOp, instead of simply comparing the two ops, add two calls on Precedence and compare their results.
a / b \ c / dThe solution involves adding another loop around the left slide:
while (true) { while (current && current->leftchild) current = current->leftchild; if (current->rightchild) current = current->rightchild; else break; }
templatematrix ::matrix (unsigned int nor, unsigned int noc) { rows.resize(nor); for (unsigned int i = 0; i < nor; i++) rows[i].resize(noc); }