CS200 Lab 13, Hash Tables

Overview

  1. Download the code in Hash.java.
  2. Put the code in Eclipse (or just use an editor, if you’re a Real Programmer ☺).
  3. Examine the code and understand it.
  4. Execute the code.
  5. Implement the method alpha(), which returns the load factor.
  6. What happened to Gamma, the third string added to the hash table? It’s not in the output.
  7. Write and use the add1() method to implement linear probing, with a step size of two.
  8. Write and use the add2() method to implement double hashing, where h2() is the length of the string.
  9. Try to add ten more items to the hash. What happens? Change add2() to throw an exception in that case.