room
in Figure 5.4
should be labeled location
.
main
in CounterTest
declares a variable named interface
. interface
is a key word and cannot be the name of a variable.
getChoice
should invoke readInt
, not getInt
.
private void getChoice () { input.readInt();
getChoice
should invoke readInt
, not getInt
.
private void getChoice () { input.readInt();
isEmpty
. It should appear before the line
this.isEmpty() == (this.size() == 0)
sort
is missing the declaration of the
boolean
variable done
.
itemIndex
is simply an identifier and not a keyword. It should not appear in bold face near mid page.
indexOf
is missing the declaration of the
int
variable i
.
Now in the loop,low
is only modified by being assignedmid + 1
, andhigh
is only modified by being assignedmid - 1
. Thus (1) implies...
low
equals
high + 1
. (Note: this is not an erratum.) The while condition guarantees
that low > high
when the loop terminates. If low > high+1
, then the loop invariant tells us
list.get(high+1) < item list.get(high+1) >= itemwhich is not possible if we have an order.
QuickSorter
should implement the interface Sorter
, not extend it.
i
in method partition
should read:
int i; // index of the next item of list
interchange
near the bottom of the page:
interchange(list,pi,i);
JFrame
, similar to that shown in Figure 19.13.
DISPOSE
" is misspelled on the last line of this section.
RTLogger
should have a method for closing the log file:
/** * Close the log file. */ public void close () { logFile.close(); }
maxSublistSum
, not maxSubList
:
maxLeftSum = maxSublistSum(list, first, mid); maxRightSum = maxSublistSum(list, mid+1, last);
toString
is missing its return
statement:
return s;
clone
is missing a closing brace.
add
is missing a
void
specifier:
public void add (int i, Object obj) {