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