Question: For this project, you will write a program in Ct that implements hashing functions using resolution techniques various collision Your code must be modular and

 For this project, you will write a program in Ct that

For this project, you will write a program in Ct that implements hashing functions using resolution techniques various collision Your code must be modular and use vectors and classes. Additional information concernin these constructs will be given in class. Your solution should read strings from the termi (terminated by a value of" and output lists representing the hash tables produced using lin ear robing, and perfect hashing. I for some reason, any item(s) cannot be inserted, hashing should continue with the next item in the list and a single line should be printed before the table listing each item that could not be inserted. The hash function for both schemes is given in the slides for string hashing, using the Weiss value for R. Each collision resolution scheme should be implemented as discussed in class and in the textbook Additionally, each resolution scheme should be contained within its own class. For perfect hashing, each element of the hash table is a poi nter to secondiary hash tabie. Note that should write both a header fihpp) and a code source file (pp) for each, as well asa ashmain.cpp to drive the program. 5 FILES The HashLin class should declare a vector hash table with the table size passed as a parameter, and should contain an init method, which initializes all elements in the table to , and a print method to print out the elements of the table to the screen. Before passing the table size to t HashLin constructor, this size should be computed to be the closest prime number greater than this the number of strings to insert. The constructor can call init to initialize the hash table. The final method, insert, should take a single string as a parameter and, using the hashing method for strings, as mentioned above, place the string into the table The HashPeriect class should declare a vector hash table of size 10 and contain an init methodi which initializes all elements in the table to NULL, and a print method to print out the elements in the table and secondary tables to the screen. The HashPerfect constructor simply calls init The insert method will take an entire vector of strings as a parameter, determine the number strings that hash to each location, dynamically allocate memory for each location, then insert all of the strings into the secondary hash tables Note that the secondary hash tables should be o type HashLin, with sizes passed as arguments. Your program should include files with the names below (along with corresponding hpp files for the hash classes). It can be compiled with the command: gtt hashmain.cpp HashLin. cpp HashPerfect. cpp - hash .and run with the command: HEADER FILINTERFALE ./hash keys.txt

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!