CS 210 - Lab 9: Registration Revisited
Due April 19, 2000

In lab 7 (mislabeled lab 8) you checked the courses students wanted against the actual courses. In this lab you'll essentially redo that, and add some extra functionality to the process as well. Here's what you need to do: in the previous lab your data structure was a sorted Vector. You'll need to change the sorted Vectors to Hash Tables of an appropriate size. (Once you've done this, an interesting experiment would be to check the speed of the new program against the speed of what you had previously). In addition, you will add the functionality that independent study courses are not in the course file. An independent study is a course whose number is 291, 292, 293, 294, 401, 402, 403 or 404 (e.g CSCI291 would be an independent study). Students are always assumed to be allowed to enroll for independent studies.

You are to write a Hash Table class for this lab. It must be general (indeed you will use it for another task in the next lab). You should use a linked list or a vector to handle overflow (an example of a linked list hash table is in your book). In addition to get(Object key) and put(Object key, Object value), write methods output and statistics. The output method should output the elements of the table. The statistics method should print the number of buckets used, the number of buckets available, the number of buckets with overflow, and the average length of overflow for those buckets. The constructor of your hash table should take an integer which is the "guess" of how many items will be in the table. The constructor should use the rules of thumb on table size to find an appropriate size. The put method should check to see if the load factor is higher than 90% as a result of the put and if so, the table should be resized and all of the elements should be moved to the appropriate new spots.

My tolerance for code which doesn't use constants, isn't indented properly, prints out such that much of the code doesn't show up, etc. is now zero. Consider yourselves warned.

Put the usual stuff in the dropbox and hand in output which demonstrates all of the required functionality.