Errata List
Last updated on July 17, 2016.
The date after each error is the date it was posted on this list. Subsequent printings of the book will correct these errors.
If you find an error and it is not on this list, please e-mail a description of the error, the page number, and the tile/edition of the book.
Chapter 1
Page 25 (Apr. 7, 2016)Add
#endif
as line 56 to the listing at the top of the page.Chapter 2
Page 90 (Apr. 27, 2016)Exercise 10b: The sample call to
writeBlock
should bewriteBlock( '*', 3, 5)
Page 91 (Apr. 7, 2016)
The data type for
result
is missing in the second line on the page:int result = mystery(30);
Page 91 (Apr. 27, 2016)
In Exercise 14, add a new-line character to the
cout
statment in the main
function as follows:std::cout << "The value of f(8) is \n" << f(8) << std::endl;
Chapter 3
Page 100 (Apr. 27, 2016)In line 32 of Listing 3-1, precede
vector
with std::
as follows:std::vector toVector() const
;Page 102 (Apr. 27, 2016)
In the method
toVector
, std::
is missing twice as follows:
template<class ItemType>
std::vector<ItemType> ArrayBag::toVector() const
{
std::vector bagContents;
Interlude 2
Page 125 (Apr. 7, 2016)In Listing C2-2 at the bottom of the page, change the method name
fixedLeak
in line 13 to unleakyMethod
.Chapter 10
Page 321 (May 27, 2016)Revise Exercise 3d by moving the occurrence of n, as follows:
d. Displaying all
Chapter 12
Page 371 (Apr. 7, 2016)The comment in line 60 of Listing 12-1 should end with
*/
.Page 389 (May 27, 2016)
In Exercise 1b, we assume that
spherePtr
points to an instance of Sphere
, and ballPtr
points to an instance of Ball
.Chapter 13
Page 412 (May 27, 2016)In Exercise 13, replace
aQueue
in the third and fourth axioms with Queue()
three times.Thus, those two axioms should be
(Queue().enqueue(item)).dequeue() ==> Queue()
(Queue().enqueue(item)).peekFront() = item
Chapter 14
Page 432 (June 9, 2016)In the definition of the method
dequeue
, replace removedSorted
with removed
.Chapter 15
Page 471 (June 9, 2016)Exercise 6 is the same as Exercise 3a in Chapter 16. Wait until then before solving it.
Page 474 (June 9, 2016)
In the first line on the page, which is part c of Exercise 20, delete the word "formal."
Chapter 16
Page 491 (June 9, 2016)In the third line of the pseudocode at the top of the page, change
nodeStack.peek(curPtr)
to
curPtr = nodeStack.peek()
. Page 511 (June 9, 2016)
Exercise 9: Replace the first sentence with "Trace the nonrecursive inorder traversal algorithm for the binary search tree pictured in Figure 16-4." In the second sentence, delete the word "implicit."
Exercise 11: Change 13 to 14.
Chapter 17
Page 524 (Apr. 7, 2016)Line 5 of Listing 17-2 should be
#include
<memory>
Chapter 18
Page 558 (Apr. 7, 2016)In the header of the method
add
near the bottom of the page, a comma is misplaced. The code should be as follows:
bool ArrayDictionary::add(const KeyType& searchKey,
const ValueType& newValue,)
throw(PrecondViolatedExcept)
Page 584 (July 17, 2016)
Delete the duplicate occurrence of
nextEntryPtr
in Line 22 of Listing 18-5.Chapter 20
Page 647 (Apr. 27, 2016)The third statement in the list of three statements at the beginning of the page should be numbered "3" instead of "2."
Page 661 (July 17, 2016)
The graph in Figure 20-36 is for only Exercise 10.
(End of errata)