Corrections for the Fourth Edition

Data Structures and Other Objects Using Java (Fourth Edition)
by Michael Main
ISBN 0132576244



 
Pages 14 and 15:
The two uses of println should both be printf.
 
Page 34
java.math.abs should be java.lang.Math.abs.
 
Page 84:
Last paragraph has a statement "It might be better if the actual return type of the clone method was Location rather than Object…." This applies to older versions of Java. Our new code for the clone method does indeed have a return type of Location.
 
Page 113:
Problem 9 asks what kind of exception will be thrown by the code snippet, but this is actually a compile-time error, because b has not been initialized.
 
Page 237:
Since Java no longer requires the clone() method to return an Object, it would be preferable for DoubleLinkedSeq.clone() to return a DoubleLinkedSeq.
 
Page 258:
Near the bottom the text starts to talk about replacing Integer with Character. Thus, the line of code (the method header) is supposed to have Integer replaced with Character already. Otherwise it looks just like the code above.
 
Page 263:
There's a stray L in the code block.
 
Page 282:
In the first code block there are two extraneous semicolons.
 
Page 283:
public class Node should be public class Node
 
Page 316:
This is a printing problem, but in the stack of three books, the titles on the spines are not legible. The titles, from the top, should be: NOVEL, Thesaurus, and Dictionary.
 
Page 333:
The text states that in the case of a division by 0, the program throws an IllegalArgumentException in the evaluateStackTops method. This is not true. A division by zero using doubles results in an infinity value, which is stated in the comments in the code on the previous page.
 
Page 341:
The text mentions an ObjectStack, but this should be ArrayStack.
 
Page 398:
Problems 20 and 21 are duplicate. Please delete one of them.
 
Page 479:
The learn method header is missing the generic type after BTNode.
 
Page 703:
It would be better to use ArrayList instead of Vector, since Vector is now an obsolete collection.
 
Page 805 (Appendix G):
I apologize because somehow the Big-O definition has been completely messed up! The main corrections are given here:
 
 
Formal Definition of Big-O
 
When we say that “T(n) is an O(F(n)) function,rdquo; we mean that there is some fixed number that we call the threshold and some constant multiplier that we call c, such that:
 
Whenever nthreshold, then T(n) ≤ cF(n)
 
For example, consider the funciton T(n) = 3n2 + 9n. Some arithmetic shows that whenever n ≥ 9, then 3n2 + 9n ≤ 4n2. Therefore, using a threshold of 9 and a constant multiplier of 4 we can see that:
 
3n2 + 9n is an O(n2) function.
 
Many thanks to Professor Curt Powley at Hawaii Pacific for pointing out the error. He also suggests that students may understand the arithmetic of this example more easily using a threshold of 1 and a constant multiplier of 12, since when n ≥ 1:
 
3n2 + 9n ≤ 3n2 + 9n2 = 12n2.
 
Page 809:
The correct output from the statement printf("%(d", -42) is (42). It prints negative numbers in accounting style, using a set of parentheses around the number instead of a negative sign.
If you spot any more bugs, I'd be delighted to hear from you! Thanks.
--Michael Main (main@colorado.edu)