Data Structures and Abstractions with Java
(5th edition)
by Frank M. Carrano and Timothy M. Henry
Errata List
Last updated on January 2, 2024.
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 Prerequisites
Page xxvii (27) (Sept. 6, 2018)
Replace Chapter 6 as a prerequisite for Chapter 10 with Chapter 1
Chapter 8
Page 250 (Mar. 14, 2020)
At the top of the page, note that the third line of code is correct: checkCapacity(newSize - 1)
. However, in the online source code, that line appears as checkCapacity(newSize)
. It should be checkCapacity(newSize - 1)
as it appears in the book.
Page 254 (Mar. 14, 2020)
In Segment 8.21, last paragraph: The method isNewNodeNeeded
should return true if the chain has no nodes available for use in the queue.
Page 260 (Oct. 26, 2018)
In part b of Figure 8-19, add an arrow from the original first node to the new first node.
Chapter 10
Page 295 (Sept. 6, 2018)
Replace Chapter 6 as a prerequisite with "Chapter 1 Bags"
Page 312 (Sept. 6, 2018)
In Project 8 (continuation), first sentence at the top of the page, replace "objects in" with "people on"
In Project 9, second paragraph, first sentence, replace "any entry in a list of ingredients" with "an ingredient in a recipe"
In Project 13, replace "VectorList" with "OurList"
Chapter 11
Page 326 (Apr. 20, 2018)
Segment 11.15: Revise the text immediately after the code for the add
method, as follows:
"This method differs from the previous add
method because it usually calls the private
method makeRoom
, whose definition appears in Segment 11.9, to make room in the array for the new entry. The only time it does not call makeRoom
is when the addition is at the
end of the list. Recall that Study Question 5 asked you to define makeRoom
."
Page 330 (Sept. 6, 2018)
Reword Project 11 as follows:
"Repeat Project 8 in Chapter 10, but use an instance of AList
instead of ArrayList
.
Chapter 12
Page 360 (Sept. 6, 2018)
In Project 11, delete the words "1 through 6 and 10 through 17."
Chapter 13
Page 399 (Sept. 6, 2018)
In Project 1, add the words "within the inner class" after "priorNode
" in the last sentence.
In Projects 2 and 3, change "ListIterator
" to "java.util.ListIterator
"
Page 400 (Sept. 6, 2018)
In Project 9, replace "an iterator" with "iterators for ingredients and directions".
In Project 10, second sentence, replace "consecutive integers" with "adjacent integers".
Chapter 14
Page 424 (May 7, 2018)
In Exercise 12, the algorithm is in Segment 14.29, not Segment 14.28.
Chapter 15
Page 451 (Apr. 20, 2018)
Segment 15.18: Change public
to private
in the header of the method insertionSort
.
Chapter 16
Page 472 (Oct. 26, 2018)
In the pseudocode comments at the bottom of the page, change "the beginning of the array" to "indexFromLeft" and change "the end of the array" to "indexFromRight"
Chapter 18
Page 539 (Sept. 6, 2018)
In Project 7,
Delete "QueueBase
" in the second sentence.
In part b, replace "the base class QueueBase
" with "your base class"
Chapter 20
Page 581 (Apr. 20, 2018)
Segment 20.16: Change the body of the if
statement as follows:
wordTable.add(nextWord, new Integer.valueOf(1));
As of Java 9, the constructors for wrapper classes, such as Integer
and Double
, are deprecated. Instead, you should use the method valueOf
, which was introduced in Java 5.
Chapter 23
Page 650 (Apr. 20, 2018)
In the class KeyIterator
at the top of the page, make the following changes:
NumberLeft
should be numberLeft
Insert a blank line between the methods next
and remove
Page 642 (Jan. 2, 2024)
Change the hash code 6 to 7. It then hashes to index 2. After expanding the hash table to 11 locations, the hash function c % 11 places the hash code 20 at index 9, and 7 at index 7. The hash code 18 causes a collision at index 7, so we probe ahead and place it at index 8. The hash code 14 is placed at index 3.
Java Interlude 9
Page 724 (Apr. 20, 2018)
Segment J9.20, third line: Change privateSetTree
to initializeTree
.
Chapter 26
Page 732 (Apr. 20, 2018)
Listing 26-2: The import
statement is not necessary.
Page 742 (Oct. 27, 2019)
Figure 26-7: In the leftmost portions of parts a and b, erase the arrow in Node N that points to a right child. Node N has only a left child.
Page 747 (Apr. 20, 2018)
Segment 26.30: Revise the 5th comment before the method removeEntry
, as follows:
// Returns: The root node of the resulting tree; if anEntryentry matches
Make the same change to entry
in the body of the method:
int comparison = anEntryentry.compareTo(rootData);
Page 748 (Apr. 20, 2018)
Segment 26.32: The comment on the closing brace of the method removeFromRoot
should contain removeFromRoot
instead of removeEntry
.
Chapter 28
Pages 796-797 (Apr. 20, 2018)
Segment 28.12: In the private method addEntry
, we prefer to not leave assert
statements in production code. Please change the two assert
statements in this method to comments.
Chapter 29
Page 847 (Oct. 26, 2018)
In Line 5, change "Figure 29-25" to "Figure 29-26"
Chapter 30
Page 867 (Mar. 14, 2020)
Project 9 should ask you to repeat Project 15 in Chapter 11, instead of Project 16.
Supplement 4 (online)
Page S4-40 (Apr. 20, 2018)
Answer 4: Revise the if
statement in the method ensureCapacity
as follows:
if (lastIndex >= heap.length - 1)
(End of errata)