Question
In C++ ***add.txt*** air balloon car den elf fun giraffe iodine jolly kelvin ***search.txt*** air loon park den elf funny gaffe dine jolly kelvin ***formula
In C++
***add.txt*** air balloon car den elf fun giraffe iodine jolly kelvin ***search.txt*** air loon park den elf funny gaffe dine jolly kelvin ***formula for calculating key address*** int hashFunction(char *insertKey, int keyLength) { int sum = 0; for (int j = 0; j Preliminary task: 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 (see textbook) 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 hw8add.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 hw8search.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 don't 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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started