Write a program to hash 5 letter words. You will decide on your own hash function. Use a table size of 2003. Use separate chaining. You must use the Standard Template Library list class for your chains. Allow for the following options (the user should be able to choose from the options as many times as they want):
Insert words from a user specified file
Insert word
Search for a word
Remove a word
Print words in table to a user specified file
You must make your program keep track of the following things:
Keep a count of the number of collisions when doing inserts. A collision is when a word is being inserted into a non-empty list; this should add 1 to the count (regardless of how many words are already in the list). All other options should not affect this count in any way.
Keep track of how long each list is.
Then when the program is over, print out the number of collisions, the average list length, and the longest list length
Take this as a CHALLENGE????????????
Insert words from a user specified file
Insert word
Search for a word
Remove a word
Print words in table to a user specified file
You must make your program keep track of the following things:
Keep a count of the number of collisions when doing inserts. A collision is when a word is being inserted into a non-empty list; this should add 1 to the count (regardless of how many words are already in the list). All other options should not affect this count in any way.
Keep track of how long each list is.
Then when the program is over, print out the number of collisions, the average list length, and the longest list length
Take this as a CHALLENGE????????????
