In this homework, you will implement three ways to represent a set of
integers. We provide a solution to Exercise 13 of Chapter 13
(page 238). In this Homework, you
will modify this code so that we have
an interface IntSet, and abstract base class (put keyword
abstract before the class declaration)
AbstractIntSet that implements this interface and provides
default (possibly inefficient) implementations of most of the methods,
and three concrete classes that inherit from the abstract base class
and provide actual implementations:
Stack).
java.util.HashTable
which maps Integer objects to themselves (if in the
set) or null (if not in the set). The keys method of
this class which returns a java.util.Enumeration, which will be very
useful.
(Don't use the library class HashSet.)
IntSet interface requires the following functionality:
IntSet
and has the same elements.
IntIterator.
IntIterator interface requires
/afs/cs.uwm.edu/users/classes/cs431/src/homework8The interfaces should not be changed.
You need to give (perhaps inefficient) implementations
of all methods except add and iterator
in the AbstractIntSet class.
The inefficient implementation should be overridden if a more
efficient implementation is possible.
We also provide a driver and some skeleton files.
Leave your code in the directory homework8 in your AFS folder: