Objectives

The goal of this lab period is to give you an opportunity to implement a Hashtable. Like your BSTMap, it should implement the MyMap interface and store KeyValuePairs.

Tasks

  1. Make a new folder for this week's project.
  2. Copy MyMap.java and KeyValuePair.java from last week's project.
  3. Create a Hashtable class that implements MyMap:
    public class HashTable<K,V> implements MyMap<K,V>

    You may design your own implementation. It is up to you whether or not to use the default hash function and it is up to you how to handle collisions.

  4. Test your class thoroughly. Two projects ago, when you implemented BSTMap, it was important to ensure that getPairs() returned a list of pairs in pre-order. For a Hashtable, the order is not important, so you can return your pairs in the order most convenient to you.

When you are done with the lab exercises, you may start on the rest of the project.


© 2017 Caitrin Eaton.