C++: An Introduction to Data Structures

 
[ Errata List for the Lab Manual is here.]

 

Errors and Notes for all printings, including the 4th and Later Printings

Page

Line

Change

To

54 18T [ROWS][COLUMNS][RANKS] [NUM_ROWS][NUM_COLUMNS][NUM_RANKS]
70 7B block of 40 block of 36
72 Exer. 18 char[16] name char name[16]
102 11T compilation error because 'P' run-time error because 'P'(80)
126 4B ala C a la C
130 12T str(strstream) strstream.str()
151 1T Ci = Pi % 2773 Ci = Pi17 % 2773
223 diagram Correct diagram is:
 
273 10B const vector & const vector<T> &
274 11T const vector & const vector<T> &
295 6T d.pop_front(value);
Remove value at the front of d
d.pop_front();
Remove element at the front of d
299 13B stack<C> st; stack<T, C<T> > st;
326 37 21, 24, 34, 53, ... 21, 34, 55, ...
328 5T in the next section in Section 7.4
332 14B if ('A' <= ch) if ( ('A' <= ch)
338 1T Insert a semicolon (;) at the end of the first line, and insert

int main()

below first line

 
346 13B bterm -> !bfactor ... bfactor -> !bfactor ...
355 15B first < last first <= last
369

370

371

15B

8T, 18B

9T, 11T

("B" = bottom, "T" = top)

container con container whose first element is pointed to by iterator con
412 First diagram The bottom 0xeffff864

Also, the arrow from the bottom box that points to top box (with address 0xeffff864)

0xeffff860

Should point to the second box from the top (with address 0xefff860)

425 4B = double[numValues]; = new double[numValues];
443 Exer. 13 Exercise 17 of Sec. 6.4 Exercise 7 of Sec. 6.3
499 Diagram Add a back link from node containing E to node containing B  
514 17B boolean bool
515 14T boolean bool
516 22B

9B & 11B

boolean

 
x[loc]

bool

 
v[loc]

532 Figure 10.4 The code for class UserInfo
class UserInfo
{
 public: // ***** function members and friends ***** //
  // -- id accessor
  string id() const { return myId; }

  //--- input operator
  friend istream & operator>>(istream & in, UserInfo & user);

  //--- equals operator
  bool operator==(const UserInfo & user) const
  { return myId == user.myId &&
           myPassword == user.myPassword; }

  //--- less-than operator
  bool operator<(const UserInfo & user) const
  { return myId < user.myId; }

  //--- greater-than operator
  bool operator>(const UserInfo & user) const
  { return myId > user.myId; }

 private: // ***** data members ***** //
  string myId,
         myPassword;
};
533 15B user.id user.id()
554 10B Delete() DeleteAux()
686 Exercise 3 and auto
762 3rdentry of cmath atan2(double y) atan2(double y, double x)
803 9B Delete ",terminated by a null character"  
806 20B, 25B Delete the right parenthesis after
s.replace(pos1, n1,
 

 

Errors and Notes for the 3rd Printing

<

Page

Line

Change

To

vii 13T
("B" = bottom, "T" = top)
Tom,Joan, and Abigail Tom, Joan, Abigail, and Micah

Note:  Micah is my seventh grandchild.

20 17B item < a[mid] (item < a[mid])
  15B
item > a[mid] (item > a[mid])
21 3T
Delete the sentence beginning
"If the value 76 is used ... "
 
22 7B
mid = n; mid = n - 1;
42 4B
  (1 + 1/2 + 1/8 + 1/128) X 219 = 856064.0
53 6B 84.5 65.0
54 2&3B
typedef int InventoryArray[NUM_MAKES, NUM_STYLES,
                           NUM_COLORS, int, int]
const int NUM_YEARS = 10,  // 1990-1999
          NUM_MODELS = 6;
typedef int InventoryArray[NUM_MAKES][NUM_STYLES]
                          [NUM_COLORS][NUM_YEARS][NUM_MODELS];
55 2T [1997] [7]
57 5B page 0 page 2 (counting from 0)
66 15B Date birthdate; Date birth;
110 9 in Fig. 3.7 * operator<< ... /* operator<< ...
124 24B int i = j = index = 0; int i = 0, j = 0, index = 0
  19B str.Length())

str.Length()

Also, append a right paren ) to this line.

191 Exer. 9 Exercise 7 Exercise 8
295 2nd line of Fig 6.6 <iostream. <iostream>
299 7-8T a class template stack<C> whose type parameter is a container type a class template stack<T, C<T> > one of whose type parameters is a container type
  11T & 13B stack<C> stack<T, C<T> >
  17T stack< deque<T> > stack<T, deque<T> >
  19T stack< vector<T> > stack<T, vector<T> >
  20T stack< list<T> > stack<T, list<T> >
301 8T queue< deque<T> > queue<T, deque<T> >
  10T deque<T, list<T> > deque<T, list<T> >
314 19T Type< Container> > objectName; Type<T, Container<T> > objectName;
  21 The type parameter of an adapter One of the type parameters of an adapter
332 14B and &&
337 20T if (n >= 1) if (n <= 1)
345 10T return (symbol == '('); return (symbol == ')');
346 13B bterm -> !bfactor ... bfactor -> !bfactor ...
  Exer. 14 false || x || true (false || x) || true
355 15B first < last first <= last
363 Exer. 4 2n - 1 2n - 1
364 Exer. 12 x = 2; x *= 2;
379 Prob. 1-16 The numbers of the exercises referred to in these problems should each be increased by 1; i.e., from 20, 21, ..., 35 to 21, 22, ..., 36, respectively
412 Second diagram Address 0xefff860 in bottommost box 0xefff864
413 Diagram Address 0xefff860 in bottommost box 0xefff864
455 13-14T cout << "\nMerge l1 and l3:\n";
l1.merge(l3);

Although technically not an error, merge() is applied to a 
sorted list (l1) and unsorted one (l3), so the output on p. 456 is "strange." 

cout << "\nSort l3 and then merge l1 and l3:\n";
l3.sort();
l1.merge(l3);
456 15-16T Merge l1 and l3:
2  111  111  111  111  555  555  555  2222  222  22  2

(Assuming the above change is made on p. 455)

Sort l3 and then merge l1 and l3:
2  2  22  111  111  111  111  222  555  555  555  2222 
496 2T define #define
515 14T int & loc NodePointer & locptr
525 3T value in its left child (if there is one) values in its left subtree (if there are any)
  4T value in its right child (if there is one) values in its right subtree (if there are any)
  Line 4 in boxed display value in left child

value in right child

values in left subtree

values in right subtree

543 10T SearchAux(locptr->left, item); return SearchAux(locptr->left, item);
  12T SearchAux(locptr->right, item); return SearchAux(locptr->right, item);
  17B bool (return type of Insert) void
  13B Make locptr a reference parameter: BinNodePointer & locptr
  9B Change root to locptr
and BSTNode to BinNode
locptr = new BinNode(item);
674-5   The diagrams on p. 675 are misplaced. Each should be moved up ahead of the sentence that precedes it.  
800 Last 2 lines of Table D.3 Switch the descriptions of toupper() and tolower()  
809 13T exception() exception
822 Question 17 Second 0 0.5
  Question 19 4, 8, 10 2, 2, 2
828 Ques. 4 Right child of node I should be L.

Replace node S with T and balance factor 0. Right child should then be Y and node S should become the left child of T with bal. factor 0.

 
837 Entry for Null character 46 48

 

Errors and Notes for the 1st & 2nd Printings
 


My thanks to those who have reported errors to me, including:



  This page maintained by Larry Nyhoff Last modified: