Errata List

Last updated on February 24, 2017.
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.


Page 13 (Jan. 28, 2015)
In the next-to-last sentence of the first paragraph in Segment P.13, the reference should be to Listing C-1 of Appendix C.

Chapter 1

Page 36 (Mar. 30, 2015)
In Question 5, change the word "find" to "display."

Java Interlude 1

Page 57 (Jan. 16, 2015)
In the first sentence, the reference should be to Listing C-1 of Appendix C.

Chapter 2

Page 65 (Sept. 15, 2014)
In Line 43 of the listing, "arraybag" should be "array bag" in the comment before the method isArrayFull.

Page 77 (Apr. 19, 2015)
In the second Security Note, the sixth word should be "decremented" instead of "incremented."

Source Code for Readers (Mar. 30, 2015)
In SourceCodeForReaders4e/03Chapter02/2.17/, Line 25, desiredCapacity should be capacity. Also, the method checkInitialization in Lines 73 - 79 is unnecessary in this version of the class.

Chapter 3

Page 114 (Sept. 15, 2014)
In Listing 3-3, the body of the method testIsEmpty should be indented by three spaces.

Chapter 4

Page 142 (Apr. 19, 2015)
There are two occurrences of O(2n) that should be O(2n). One is in the second line before Figure 4-9, and the other is in the 5th line of Segment 4.22.

Page 149 (Sept. 15, 2014)
In Exercise 16 at the top of the page, 2n should be 2n.

Page 151 (Apr. 19, 2015)
In the answer to Self-Test Question 3, 2n should be 2n six times.

Chapter 7

Page 222 (Sept. 15, 2014)
In the second line at the top of the page, delete the word "formal."

Java Interlude 3

Page 241 (Mar. 30, 2015)
The method header at the end of the page, just before the Programming Tip, should not have n as a parameter. Thus, it should be

public static <T extends Comparable<? super T>> void arrayMinimum(T[] a)

Page 242 (Feb. 9, 2015)
In Figure JI3-1, the shaft of the arrow that points to the interface Comparable should be dashed.

Chapter 8

Page 259 (Sept. 15, 2014)
At the bottom of the page, the comment in the method insertionSort should be

// If fewer than two items are in the chain,

instead of

// If zero or one item is in the chain,

Chapter 10

Page 323 (Nov. 18, 2014)
In Segment 10.20, remove the minus sign within the definition of the compareTo method.

Chapter 11

Page 343 (Jan. 8, 2015)
In the 10th line of the method ensureCapacity at the bottom of the page, the call to checkCapacity should be

checkCapacity(newSize - 1);

Chapter 13

Page 390 (Sept. 15, 2014)
In Segment 13.14, the second line in the body of the method add should be

list[numberOfEntries + 1] = newEntry;

Page 392 (Oct. 27, 2014)
In the last line of Exercise 2, correct the spelling of "implementation."

Chapter 14

Page 406 (Sept. 15, 2014)
In Line 31 of the listing, replace the word "List" with "The chain" in the precondition.

Page 419 (Sept. 15, 2014)
In Figure 14-11, the heading on the second column should be "AList" instead of "Alist"

Chapter 15

Page 457 (Sept. 15, 2014)
In Line 35 of the listing, delete the word "public."

Page 466 (Jan. 14, 2015)
In Project 8, change the first line of the second paragraph to

Modify the methods in the interface Iterator so that they will throw the exception StateChangedException . . .

Chapter 17

Page 524 (Nov. 18, 2014)
In Project 2, replace LListRevised with LinkedChainList.

Chapter 18

Page 537 (Sept. 15, 2014)
Just beyond mid-page, the comment on the closing brace of the method inArray should be

// end inArray

instead of

// end contains

Chapter 20

Page 582 (Sept. 15, 2014)
Near the bottom of the page, the line Double size of array after the last if statement in the pseudocode should be indented by three spaces.

Chapter 21

Pages 598 - 599 and 604 - 606 (Apr. 8, 2016)
The hash index for 555-1214 was given as 52, but it is actually 2. The examples should use 555-1264 instead of 555-1214. Note that 1264 % 101 = 52. Change 555-1214 to 555-1264 as follows:
2 times on page 598 near the bottom of the page.
1 time on page 599 in Figure 21-2.
3 times on page 604, twice in Segment 21.14 and once in Figure 21-3.
2 times on page 605 in Figure 21-4.
2 times on page 606 in Figure 21-5.

Chapter 22

Page 634 (Sept. 15, 2014)
In the method enlargeHashTable, insert a fourth statement into the body of the method, as follows:

TableEntry[] oldTable = hashTable;
int oldSize = hashTable.length;
int newSize = getNextPrime(oldSize + oldSize);

Note that the available source code is correct.

Page 637 (Oct. 27, 2014)
In Exercise 4, replace the two occurrences of "rehash" with enlargeHashTable.

Chapter 23

Page 657 (Nov. 21, 2014)
In Statement 16 of Listing 23-5, replace reset with resetCurrentNode.

Page 668 (Apr. 8, 2016)
In Project 2, line 3, replace "full" with "complete."

Chapter 24

Page 681 (Aug. 5, 2016)
In segment 24.9 near the bottom of the page, the methods getHeight and getNumberOfNodes will throw a NullPointerException, if the tree is empty. The method definitions should appear as follows:

public int getHeight()
   int height = 0;
   if (root != null)
      height = root.getHeight();
   return height;
} // end getHeight

public int getNumberOfNodes()
   int numberOfNodes = 0;
   if (root != null)
      numberOfNodes = root.getNumberOfNodes();
   return numberOfNodes;
} // end getNumberOfNodes

Page 684 (Nov. 21, 2014)
Replace BinaryNodeInterface with BinaryNode in the first statement of the body of the method iterativeInorderTraverse:

StackInterface<BinaryNodeInterface<T>> nodeStack = new LinkedStack<>();

Chapter 26

Page 766 (Oct. 27, 2014)
In the constructor for Maxheap, insert a second statement into the body of the method, as follows:

this(entries.length); // Call other constructor
lastIndex = entries.length;
assert initialized = true;

Chapter 27

Page 801 (Nov. 18, 2014)
In part a of Figure 27-33, the labels on the arrows should be "Split."
Both parts of the figure show two orientations of a node. The word "OR" is missing from between these orientations in both parts.

Page 802 (Nov. 18, 2014)
In part a of Figure 27-34, the label on the arrow should be "Split."

Chapter 28

Page 815 (May 15, 2015)
In Figure 28-6, the apostrophe in Martha's did not print correctly.

Appendix B

Page B-47 (Feb. 12, 2015)
In Line 4 of Segment B.91, change "size" to "type" in the following sentence:

For example, if a and b are arrays of the same sizetype, the assignment . . .

Page B-48 (Feb. 12, 2015)
In the first line on the page, make the following insertion after the first word:

If the arrays a and b have the same size and type, and you want the array b to have the same values as the array a, but . . .

Page B-53 (May 15, 2015)
The method isLowerCases near the bottom of the page should be isLowerCase.

Appendix C

Page C-5 (Feb. 9, 2015)
Insert "a" in the following sentence, which appears in the first line on the page:

As we discussed in Segment B.14, a reference variable . . .

Appendix D

Page 877 (Mar. 30, 2015)
In Segment D.10, last paragraph, second line:
"cannot both" should be "cannot have both"

(End of errata)