Error Information for Data Structures and Problem Solving Using Java

Errata

Here is the errata list for Data Structures and Problem Solving Using Java, by Mark Allen Weiss. Replacement pages are provided where possible as PDF files. Some PDF fils were corrupt because of unusual end-of-chapter fonts; in that case postscript files are used instead.

Some of the errors affect the source code. See the list of code fixes.

Here is a separate list of errors in the Instructor's Manual.


Click here to report a new error.

Seventh printing (no replacement pages)

  DATE   PAGE  WHO  PROBLEM
--------  ---  ---  ----------------------------------------------------------
01/15/01   83   DM  Change "overloading" to "overriding" in final/abstract
                    /static/other methods section.
03/26/00  189   KH  Change "BigDecimal" to "BigInteger"
03/26/00  190   KH  Change "BigDecimal" to "BigInteger"
03/26/00  215   KH  Line 7: delete this line; thisPosition is not used.
03/26/00  230   PT  Change sum h_k to sum 1 / h_k
03/29/00  265   KH  Line 21: Change "C=13" to "C=11"
12/05/00  394   SG  Line 43, change ++ to --.
12/05/00  395   SG  Line 9-11: adding two to simulate leaving the
                    queue doesn't work, occasionally reporting false cycles
04/11/00  429   KH  Line 25: Change return type to void, and remove return on line 26.
12/05/00  516   BZ  Caption for Fig 18.31 should say "Right-left"
01/31/01  520   TS  In second paragraph, add remark that if X is the root,
                    after the color flip, it will be red, but can be
                    made black immediately to restore property 2.
04/25/00  571   EG  Figure 19.13 currentSize is incremented when an existing
                    item is replaced. This was not intented, but does no harm.
08/08/00 759-760 MAW  When an applet is loaded, its constructor is called prior to
                    the call to init. Thus the code in Figure D.21 actually
                    adds two GUI instances for applets. Replace line 16 with
                    lines 9 to 10, and then delete the entire init() method.

Third printing

  DATE   PAGE  WHO  PROBLEM
--------  ---  ---  ----------------------------------------------------------
07/13/99  006  JS   Second line from bottom, change "principle" to "principal" (twice)
07/13/99  007  JS   First line from bottom, change "indentifier" to "identifier"
06/29/99  019  CWA  Second line from bottom, change "scope" to "scopes"
07/13/99  025  JS   Footnote 2, line 1, change "describe" to "describes"
02/25/99  055  AK   Next to last sentance in opening paragraph of Section 3.2:
                    Change "to the user of the object" to "by methods that are not in the object's class"
10/15/99  128  MAW  Margin note 3, change "optimizating" to "optimizing"
10/15/99  131  ED   Line 2, change "then" to "than"
08/25/99  180  MAW  Second paragraph, change "array of char" to "String"
11/18/99  230  PT   Line 11, change sum h_k to sum 1 / h_k
08/25/99  231  MAW  Last sentence before Section 8.5.1: change "in in" to "in"
08/25/99  249  KH   Line 3, change "a.length" to "a.length - 1"
05/02/99  267  HK   In Figure 9.5, large expected values could cause overflow.
                    The online code has been altered to add logarithms until larger than -exceptedValue.
03/18/99  267  AK   In Figure 9.6, line 9, multiply return value by -1.
08/25/99  268  MAW  Five lines from bottom, change "ith" to "last"
08/25/99  272  MAW  Line 2 of the proof: change "less" to "greater"
08/25/99  276  MAW  Common error #3: Change "random numbers" to "random number generators"
10/15/99  306  CWA  Six lines from bottom, change "tokens with" to "tokens from"
10/15/99  309  MAW  Next-to-last line, change "is newline" to "is a newline"
08/25/99  314  MAW  Switch 4^5 and 3 in two places to be consistent with later example
03/06/99  359  SCS  In Figure 13.8, line 13, change "EventSet" to "eventSet"
03/06/99  361  SCS  In Figure 13.9, line 40, change "gets" to "but gets" to match sample output
08/25/99  398  MAW  In part 2 of the figure, V_3 should not have a distance attached to it
02/21/99  418  SCS  In Figure 15.9, line 27, change "CurrentSize" to "currentSize"
06/29/99  465  CWA  Twelve lines from bottom, change "reference" to "referenced"
03/27/99  541  DH   Last line, change "children" to "data items"
04/06/99  542  DH   Line -10, change "first level could " to "next level could"
10/15/99  602  MAW  End of Section 20.6.2, change OMEGA( N ) to OMEGA( N^2 )
08/25/99  623  MAW  Lines 3 and 4 from bottom, change "deleteMax" to "findMax"
11/28/99  623       Caption Fig 21.7, remove "and a zig"
08/25/99  676  MAW  Change 16 to 15
10/15/99  677  MAW  Margin note 2, change "logarithm" to "logarithmic"
03/19/99  699  AB   In item 3, change the : in the CLASSPATH to a ;

Second printing

  DATE   PAGE  WHO  PROBLEM
--------  ---  ---  ----------------------------------------------------------
02/05/98  024  HK   Change MCMLXLVIII to MCMXCVIII
07/14/98  028  SR   In last paragraph, add the following for clarity:
                    "Some operations are performed on references themselves, while others are
                    performed on the objects being referenced."
07/14/98 029-0 SR   In Section 2.2, change first two sentences and margin note to indicate that
                    an object is AN INSTANCE OF any of the nonprimitive types and is different from
                    PRIMITIVE DATA.  The change forces a rebreak for page 30.
07/14/98  035  SR   The toString method for primitive types is found in a wrapper class.
                    Need to fix the paragraph in Section 2.3.5. See Page 36 errata also.
08/26/98  038       The lottery program allows duplicate numbers to be selected,
                    which is not how the Florida Lottery actually works.
                    But it's more trouble than it's worth to try and fix this,
                    since the actual rules to do not affect the ideas of the example.
07/14/98  041  SR   Figure 2.5, line 7: Add to print statement: + " "
02/07/98  048  EG   Figure 2.11: Add an import java.io.* as line 0
03/25/98  065  BL   Line -2, Change "Supporting" to "Exiting", and on next line,
                    delete everything upto and including the second comma.
02/04/99  081  MAW  (Seven lines from the bottom) doWork needs to have void return type.
06/29/98  084  SR   Figure 4.5, line 11: Insert "public" prior to "abstract"
03/18/98  085  HK   Stylistic improvement: delete line 22, and replace PI with Math.PI on line 19
12/16/98  088  SR   The code reads dimensions as ints instead of doubles.
                    TestShape.java is fixed using Java 1.1 constructs; the text fix uses 1.2 constructs.
03/25/98  092  BL   Figure 4.13, line 18: Change "Integer" to "MyInteger"
01/27/99  117  DWW  Figure 5.5, line 17, change "MaxSum" to "maxSum".
03/09/98  137  MAW  Exercises 5.10 and 5.11 require the assumption that any low-order terms are negligible.
01/27/99  138  DWW  In Exercise 5.15, start i at 1 to avoid divide by zero.
02/10/98  156  AG   Figure 6.15, line 14: Change ItemNotFound to DuplicateItem
03/19/98  176  LG   Line 1, change "constitutes" to "constitute"
02/18/98  179  EG   Figure 7.2, line 7: Change entire line to printDigit( n % 10 );
                    The (pseudocode) in the text is wrong because '0' is 48, so an int is output.
04/27/98  200  JH   Figure 7.18, line 7: change "Right" to "right"
02/06/98  209  RT   Figure 7.21, line 4: add , at end; line 5, change , to )
02/13/98  249  MAW  As written, the code places the k+1th smallest element in a[k].
                    There are two fixes. In Sort.java change the driver
                    to pass k-1 instead of k. Since this is not in the text, the
                    text fix is to change k to k-1 at lines 43 and 45.
04/13/98  261  BL   Figure 9.1, line 31, change m to M.
02/25/98  263  EG   Figure 9.2, line 19, change m to M.
04/13/98  267  BL   Figure 9.6, lines 2 and 5, change int to double.
02/26/98  326  LG   Figure 11.20 caption, change c-d to a-b.
12/04/98  413  DK   In Figure 15.2, have methods top and pop refer to Fig 15.5.
01/27/99  421  DWW  Figure 15.5, line 7, change -1 to theArray.length -1.
04/15/98  428       Line 5: change "queue" to "linked-list"
05/04/98  429  HK   Figure 15.26, line 20, Remove "public:"
04/08/98  445  JH   Line 22: Change "header" to "head".
02/19/98  462  MAW  Line 47: Change ListAll to listAll.
04/14/98  507  EG   Since "cost" is depth+1 (on Page 504), fix definition and subsequent
                    paragraph to be consistent. In definition, change "cost of accessing" to
                    "sum of the depths of". In paragraph, start with "Adding one to the result of"
07/24/98  542  MAW  Line -12: change 312,500 to 625,000.
04/06/98  595  KT   Figure 20.22; swap 17 and 20 in the second (rightmost) tree.
12/16/98 656-8 MAW  combineSiblings needs to use array-doubling for the treeArray, or compute
                    numSiblings and use it to declare treeArray.  The online code has the fix,
                    which is too complex to completely change in the text (because the line #s would change).
05/09/98  717  MAW  Remove "const" in two places.
03/15/98 738-9 MAW  In JDK 1.2, addItem will be deprecated; add should be used instead.
                    Change on both pages 738 and 739 to avoid compiler warnings. 
04/22/98  747  BL   Figure D.11, line 1: make the method public.
04/22/98  749  BL   Figure D.13, line 9: add a semicolon after the closing parenthesis.
                    Note also that java.awt.* and java.awt.event.* should be imported (but there's no room for it).

First printing

  DATE   PAGE  WHO  PROBLEM
--------  ---  ---  ----------------------------------------------------------
11/04/97  p18  MAW  Missing a ? in Section 4.1 header.
01/12/98  036  RT   Line 1, change toString to Integer.toString.
11/04/97  059  MAW  Picture got messed up. (Replacement page for Win95 only)
11/04/97  075  MAW  Missing a ? in Section 4.1 header.
01/12/98  079  RT   Section 4.2.1: Protected class members are visible to other classes in the same package.
01/27/98  130  RT   Line -5, change "sort" to "search"
11/06/97  144  CM   Last paragraph: change "extends" to "implements"
12/10/97  149  EJ   Lines 9 and 10, change "most" to "least"
02/01/98  153  RT   Line 1, since ListItr is abstract, the code below is really pseudocode. Add a parenthetical remark.
02/01/98  191  RT   Figure 7.14, line 3 and footnote: 0^0 = 1 (not 0).
                    Note also that x<p is assumed, and for this to work, p*p should not overflow a long.
                    The latter are not changed, since x<p is implied by the text discussion,
                    and long is used instead of BigDecimal simply for convenience.
11/04/97  368  MAW  Paragraph 2 shows a shorter weighted path of total cost 8.
                    However, it is not the shortest -- there is an even shorter path of
                    cost 6, going through V6 (as correctly shown on page 389).
12/10/97  418  EJ   Lines 11 and 12, change "most" to "least"
12/10/97  425  EJ   Lines 11 and 12, change "most" to "least"
11/12/97  456  MT   line 7, change "parent has" to "root has"
12/19/97  572  MAW  line -5, change "will be shown shortly" to "we see"
11/04/97  607  MAW  In Figure 20.41, table header, [] looks like () (font bug)
11/04/97  729  MAW  remove public for countTokens

Credits

CWA  Claude W. Anderson
AB   Andrew Blais
ED   Erling Danbolt
AG   Adam Gifford
EG   Eric Gossett
LG   Lawrence Grone
SG   Sumanta Guha
DH   Dennis Hamilton
KH   Keld Helsgaun
JH   Jeff Holmlund
EJ   Eli Johansen
HK   Henk Karssenberg 
DK   Dean Kelley
AK   Ahmed Khoumsi
HK   Hans Koomen
BL   Benson Limketkai
CM   Cara MacNish
DM   Don McLane
SR   Stuart Reges
SCS  Sunil C. Shah
JS   Jeffrey Shallit
TS   Tim Snyder
PT   Prasad Tadepalli
MT   Mohammad Tanabian
KT   Koichi Tsunoda
RT   Ray Toal
DWW  Debora Weber-Wulff
BZ   Brandon Zarzoza

Printing History

First Printing: October 1997
Second Printing: February 1998. Fixes errors in first printing.
Third Printing: February 1999. Fixes errors in second printing.
You can see which printing you have by looking at the bottom of the copyright page for a sequence of numbers. If you see
1 2 3 4 5 6 7 8 9 10
you have the first printing.