Write a program that uses a hash-coded data storage method to store the 400 items from file400.txt.
Your should create an APHashMap
class that implements the methods of the
APMap interface class. This interface includes
those methods that represent the AP Subset of the Map
interface.
The method for dealing with collisions should be a dynamic linked list.
You should develop your own hashing scheme to take the key field (id
) and determine the location to look for the item.
Test your new data structure and algorithm with some sample searches. The program should prompt you for an id
value and return the inv
amount or a message that the id
does not exist. Your teacher will specify some sample id
values to test out.
Your program must analyze the efficiency of your hashing scheme by determining the following statistics about your hash table:
- the % of
null
pointers in the hash table
- the average length of linked lists
- the longest linked list in the hash table
After seeing these results, you might want to try to improve upon your hashing scheme if the number of collisions is excessive.