The Set class can be implemented using Binary Search Trees or hash tables.
The BST classes are not in the textbook collection. The code and docs can be found here:
Download the code, untar the file somewhere in your CS257 directory, and add the path to your directory to your CLASSPATH. I also have a simple test problem showing how they are used (pay attention to the import statements).
Instructions on modifying the CLASSPATH were given on the Project 3 page. Just use the path to the directory you expanded the
code.tar archive to. For example, the path to the directory I used is
/home/scarl/CS257/Resources/Weiss, so that's what I added to my class path.
We'll discuss hash tables in detail next week. However, Java includes two hash table classes that are fairly easy to use by importing
java.util.HashMap. Unlike with the BST, you'll have to check for and disallow duplicate entries yourself. These classes are previewed on page 599 of the textbook and full descriptions are in Appendix D, page 789. Also see the Javadoc descriptions: Hashtable, HashMap.