Bug Fixes for Data Structures and Problem Solving Using Java

Bug Fixes

Here is the bug fix list for Data Structures and Problem Solving Using Java, by Mark Allen Weiss. The code online reflects all changes.

Click here to report a new error.

Major Problems

  DATE    WHO  FILE                               PROBLEM
--------  ---  ---------------------------------  -------------------------------
02/09/98  EG   Chapter07/RecSum.java              Fix an infinite loop in main, by changing to mid=(low+high+1)/2
03/07/98  MAW  DataStructures/PairHeap.java       Declaring a vector of size N is an O(N) operation in Java.
                                                  So, in combineSiblings, must use array doubling,
                                                  or compute the size of the array before declaring it.
03/18/99  AK   Supporting/Random.java             Return value of negExp is missing minus sign at front.
12/05/00  SG   Chapter14/Graph.java              In negative, change scratch++ to scratch-- in else clause.
04/28/99  JDH  DataStructures/SplayTree.java      Fix the find method to work for empty trees.
08/08/00  MAW  AppendixD/BasicGUIApplet.java      Since constructors are always called in applets, moved codeout of init.

Java 1.2 Incompatability

  DATE    WHO  FILE                               PROBLEM
--------  ---  ---------------------------------  -------------------------------
03/14/98  MAW  22 files. Example is               JDK 1.2 adds a class named Comparable in package java.lang.
               DataStructures/AATree.java         This creates a conflict with Supporting.Comparable.
               Complete list                      Fix via an explicit import directive:
                                                      import Supporting.Comparable;
                                                  (Notice that had Comparable been placed in any class
                                                  except java.lang, there would have been no problem).
03/15/98  MAW  AppendixD/GUI.java                 addItem is deprecated (use add instead).
03/15/98  MAW  CircleApplet.java	          The stop method in java.lang.Thread is deprecated (but still works).

Minor Problems

  DATE    WHO  FILE                               PROBLEM
--------  ---  ---------------------------------  -------------------------------
07/14/98  SR   Chapter02/Echo.java                Add a + " " when printing args[i].
06/28/98  SR   Chapter04/Rectangle.java           Make the class public.
06/28/98  SR   Chapter04/Square.java              Make the class public.
06/28/98  SR   Chapter04/Shape.java               Make the class public.
09/30/98  SR   Chapter04/TestShape.java           Read doubles instead of ints in four places.
02/16/98  MAW  DataStructures/AATree.java         deletedNode is uninitialized in recursive remove;
                                                  could cause a problem if attempt is made to remove an item smaller
                                                  than any other item in the tree prior to at least 1 successful remove.
                                                  Fix by altering the public remove.
02/13/98  MAW  DataStructures/Sort.java           Fix the off-by-one error by changing the driver to pass k-1 instead of k
02/13/98  EG   Chapter08/TestSort.java            Fix the off-by-one error by changing the print statement after quickselect.
05/02/99  HK   Supporting/Random.java             poisson overflows for very large expected values.
                                                  Fix by adding logs until sum exceeds limit.

Comments, Spacing, etc.

  DATE    WHO  FILE                               PROBLEM
--------  ---  ---------------------------------  -------------------------------
02/09/98  FR   DataStructures/Queue.java          Change most to least in the comment section.
02/09/98  FR   DataStructures/QueueAr.java        Change most to least in the comment section.
02/09/98  FR   DataStructures/QueueLi.java        Change most to least in the comment section.
01/20/99  AF   DataStructures/PriorityQueue.java  Change comment for deleteMin to return Comparable.
04/13/98  BL   Supporting/Random.java             negExp returns a double; fix javadoc section to match.
10/12/98  EM                                      Rerun javadoc to get current documentation that matches the code.
                                                  Some late code changes were not reflected in the javadoc output.


AF   Alex Farlie
EG   Eric Gossett
SG   Sumanta Guha
JDH  Jason D. Hartline
HK   Henk Karssenberg
AK   Ahmed Khoumsi
BL   Benson Limketkai
EM   Eva Magnusson
SR   Stuart Reges
FR   Fritz Ruehr