CS 223 In-Labs
In-Lab 1--Create a simple hash table
Due: at the end of lab, Thursday September 9, 2004
Objective:
To understand the components of a hash table:
- The array to hold the data
- The hash function to map the key to the array index
- Collision resolution
create a simple hash table
- You can use either an array or an ArrayList for the hash table
- You should create a class to hold the data, which will be a key, value pair
- You can use anything you want for your key and value
- For this in-lab assignment, best to keep it simple
- Use a simple hash function
- If your key is an integer, just mod by the table size
- If your key is a String, use the simple hash function given in lecture, or in your book.
- For collision resolution, use open addressing with Linear Probing
page 411-421 in your text