Question: Hash Table Study in C++ Required: 1 Header file and 1 Driver File Create a hash table class that can be used to store strings.

Hash Table Study in C++

Required: 1 Header file and 1 Driver File

Create a hash table class that can be used to store strings. The class should provide the functionality for the following operations:

Adding an element

Searching for an element

Calculating the hash for an element

Printing the hash table

For both searching and adding, collisions should be resolved with linear probing

In your driver file, create an object of your string hash table with size 11. Read from the file add.txt and insert the elements to the hash table. Keep a running total of the number of collisions that occur during construction of the table. Print the total number of collisions to the screen. When the table is built, print the contents to the screen.

Read from the file search.txt and search the hash table for the items listed. For each element, display whether or not it was found. If it was found, its index in the table should be displayed, otherwise dont print an index value. Print the number of collisions that occurred searching for the element and keep a running total. Finally, print the total number of collisions that occurred searching for the items in file.

Below is an example of sample output:

Hash Table Study in C++ Required: 1 Header file and 1 Driver

File Create a hash table class that can be used to store

Make sure your program is properly documented and good programming standards are followed.

----------------------------------------------add.txt-----------------------------------------------------------

air balloon car den elf fun giraffe iodine jolly kelvin 

----------------------------------------search.txt-----------------------------------------

air loon park den elf funny gaffe dine jolly kelvin 

Hash table built with a total of 4 collisions 0: kelvin 1: 2: car 3 den 4: elf 5: iodine 6: balloon 7: joll;y 8: air 9: giraffe 10: fun Hash table built with a total of 4 collisions 0: kelvin 1: 2: car 3 den 4: elf 5: iodine 6: balloon 7: joll;y 8: air 9: giraffe 10: fun

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!