Lab 9
Get started now

Overview

For this assignment you must implement a HashTable<E> class that implements the java.util.Set<E> interface and some additional methods described below. You will use this class to create hash tables with various capacities and draw conclusions about the ideal load factor for a hash table that is designed to hold Strings of English words.

Assignment

HashTable Class

For this assignment you must implement a HashTable class (download). Your implementation must be correct, complete, and conform to the javadoc within the file.

Please note that some methods may not be required. See your instructor for details.

Main Program

You will be working with the following three text files:

  • story.txt — A short story containing a bit over one thousand words.
  • words.txt — A list of a bit over one hundred thousand words.
  • kjv10.txt — The contents of the King James Bible containing a bit under one million words.

You do not need to submit your main program code. Instead, you should develop a strategy for determining the ideal load factor for a hash table designed to contain the words in the above files. You must describe your strategy, present your experimental results, and state and justify your conclusions.

Hints

  • Do not implement automatically resizing the hash table when the load factor exceeds some limit.
  • You are not required to implement the Iterator.remove() method.
  • If the collection changes while iterating over it, you should throw a ConcurrentModificationException. Implementing this requires a flag that gets set whenever the object changes and .hasNext() or .next() is called.
  • Given that your HashTable class uses generics, there is no circumstance under which you'd throw a ClassCastException.
  • Note that the load factor calculation includes empty (null) buckets in the count of the number of buckets.

Acknowledgements

This assignment was written by Dr. Chris Taylor.

Lab Deliverables

See your professor's instructions for details on submission guidelines and due dates.
Dr. Hasker's instructions
Dr. Taylor's class: See below
Dr. Yoder's submission instructions
If you have any questions, consult your instructor.

Monday, 15-Feb-2016 23:32:50 CST