Question: You will develop a C++ program that reads an input data set consisting of four parts: the first part is a hash table size requested

You will develop a C++ program that reads an input data set consisting of four parts: the first part is a hash table size requested by a user; the second part is a list of cities with its state, population, and geo-location. This part will end with the line InsertionEnd; the third part is a number of commands to follow; and the forth part is a list of commands.

1. After reading in a hash table size requested by a user, a hash table of the size (with open addressing, double-hashing) needs to be created. Each slot of your hash table should be a pointer of the class called City which you will be creating to store each citys name, state, population, and its geo-location (do not store double-quotes used for geolocation), and a number of collisions. Initially each pointer should be NULL.

2. Then by reading each city information line by line, their information needs to be stored in the hash table using a hash function. You will need to design your hash function so that it reduces the number of collisions. You need to specify your hash functions that will be used, i.e., h(k,i), and h_1(k) and h_2(k) using each city name as its key value.

3. After the line InsertionEnd, your program needs to print out the content of your hash table. Then a user will enter a number of commands.

4. Each command will be hash_display, hash_search, or hash_max_population.

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!