The String_collection.txt file contains 4000 random English names (keys), write a C++ program that generates hash codes for each key using polynomial accumulation.In addition your program should perform the following tasks. consider a=37 [constant]
Write separate function for each task and call it in proper order
1. Create a hash table to store the keys based on the hash values generated
➢ Hash value: h(key)=|hash code| mod N , use appropriate value for N
➢ For collision handling use separate chaining
1.1. Write a function insert(key), and find(key) to insert and find the key in the hash table.
1.2. Write a display function that display all the keys in ascending order of hash values (line-wise) such that each line display the keys (names) having the same hash value.
1.3 Find the hash value with maximum number of collisions and display all the string associated with this hash value
2. Compare the total number of collisions for a=33, 37, 39, 41
2.1. Display the total number of collisions occurred for each case
Comments
Leave a comment