Homework 7: Hash Tables

Make a hash table using single and double hashing and test it on sample data. Implement deletion.

The primary hash function will be simply modulo the table size, and we will take table sizes which are perfect powers of two, 2, 4, 8, 16, and so forth. The secondary hash function will give odd numbers 1, 3, ... , 11. The primary and secondary hash functions will use the Java hash codes for the objects, as returned by the hashCode() method defined for all objects.

We will make a hash table of strings. The strings will be read from a file and hashed into the table. Use tables of different sizes, and sample text files of different contents to test the quality of the hash functions. Come up with an average hash time as a function of load factor.

The following classes will get you started. You will need to finish up the insert and find routines and consider how to handle to delete routine. Test your project on a mix of finds, inserts and deletes.