Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Sample Input File 47 AL,Montgomery,205764,(32.34726453330, -86.2677059552) AL,Tuscaloosa,90468,(33.23360839510, -87.5268004073) AK,Anchorage,291826,(61.14986873100, -149.111113424) AZ,Surprise,117517,(33.68038351770, -112.452218439) AZ,Tempe,161719,(33.38826403070, -111.931802302) AZ,Tucson,520116,(32.15672444830, -110.877085494) AR,Fayetteville,73580,(36.07121173120, -94.1659600436) AR,Jonesboro,67263,(35.82081215380, -90.6794991686) AR,Springdale,69797,(36.18699325980, -94.1536274531) CA,Anaheim,336265,(33.83890769960, -117.857613481) CA,Burbank,103340,(34.18797996050,

image text in transcribedimage text in transcribedimage text in transcribed

Sample Input File

47 AL,Montgomery,205764,"(32.34726453330, -86.2677059552)" AL,Tuscaloosa,90468,"(33.23360839510, -87.5268004073)" AK,Anchorage,291826,"(61.14986873100, -149.111113424)" AZ,Surprise,117517,"(33.68038351770, -112.452218439)" AZ,Tempe,161719,"(33.38826403070, -111.931802302)" AZ,Tucson,520116,"(32.15672444830, -110.877085494)" AR,Fayetteville,73580,"(36.07121173120, -94.1659600436)" AR,Jonesboro,67263,"(35.82081215380, -90.6794991686)" AR,Springdale,69797,"(36.18699325980, -94.1536274531)" CA,Anaheim,336265,"(33.83890769960, -117.857613481)" CA,Burbank,103340,"(34.18797996050, -118.323429032)" CA,Oakland,390724,"(37.79087803500, -122.214859257)" CA,San Mateo,97207,"(37.55182268930, -122.312390346)" CO,Boulder,97385,"(40.02755104940, -105.251517760)" CO,Colorado Springs,416427,"(38.86727480770, -104.760664479)" CO,Denver,600158,"(39.76202837430, -104.876365322)" CT,Danbury,80893,"(41.40158986060, -73.4709386820)" CT,Hartford,124775,"(41.76607064190, -72.6834012389)" DE,Wilmington,70851,"(39.74127482270, -75.5418960925)" DC,Washington,601723,"(38.90992414260, -77.0147205666)" FL,Boca Raton,84392,"(26.37490127150, -80.1078208861)" GA,Atlanta,420003,"(33.76265246830, -84.4231419055)" GA,Savannah,136286,"(32.02836151570, -81.1783435493)" HI,Honolulu,953207,"(21.45880393050, -157.973296737)" ID,Boise City,205671,"(43.59843438970, -116.230885189)" ID,Nampa,81557,"(43.58293156810, -116.564145085)" IL,Arlington Heights,75101,"(42.09562334200, -87.9825627457)" IL,Aurora,197899,"(41.76377508370, -88.2900949057)" IL,Bloomington,76610,"(40.47567783660, -88.9700813515)" IL,Chicago,2695598,"(41.83729506150, -87.6862308732)" IN,Bloomington,80405,"(39.16374582210, -86.5257124351)" IA,Waterloo,68406,"(42.49197369320, -92.3521759342)" KS,Kansas City,145786,"(39.12346214090, -94.7441921112)" KS,Wichita,382368,"(37.69056147800, -97.3429366807)" KY,Lexington,295803,"(38.04232540220, -84.4587259608)" KY,Louisville,597337,"(38.17776899180, -85.6664099974)" LA,Kenner,66702,"(30.01069372010, -90.2550320135)" LA,Lafayette,120623,"(30.21205828150, -92.0317532321)" InsertionEnd 11 hash_display hash_search,CT,Hartford hash_search,KS,Topeka hash_max_population hash_search,FL,Miami hash_search,IL,Bloomington hash_max_population hash_search,CT,Hartford hash_search,Boise City,ID hash_search,ID,Boise City hash_display 
Program Description 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 city's name, state, population, and its geo-location (do not store double-quotes " used for geo location), and a number of collisions. Initially each pointer should be NULL 2. Then by reading cach 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, ie., h(ki), and h-1(k) and h 2(k) using each city name as its key value. The following shows an example of such data for cities: AL,Mobile,195111, "(30.67762486480,-88.1184482714)" AZ,Phoenix, 1445632, "(33.57241386950, -112.088995222)" AZ, Scottsdale,217385, "(33.68724936510, -111.865085877)" AR, Fayetteville,73580, "(36.07121173120, -94.1659600436)" AR,Fort Smith,86209, "(35.34916926360, -94.3696317306)" AR,Jonesboro,67263, "(35.82081215380, -90.6794991686)" CA,Anaheim,336265, "(33.83890769960, -117.857613481)" Program Description 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 city's name, state, population, and its geo-location (do not store double-quotes " used for geo location), and a number of collisions. Initially each pointer should be NULL 2. Then by reading cach 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, ie., h(ki), and h-1(k) and h 2(k) using each city name as its key value. The following shows an example of such data for cities: AL,Mobile,195111, "(30.67762486480,-88.1184482714)" AZ,Phoenix, 1445632, "(33.57241386950, -112.088995222)" AZ, Scottsdale,217385, "(33.68724936510, -111.865085877)" AR, Fayetteville,73580, "(36.07121173120, -94.1659600436)" AR,Fort Smith,86209, "(35.34916926360, -94.3696317306)" AR,Jonesboro,67263, "(35.82081215380, -90.6794991686)" CA,Anaheim,336265, "(33.83890769960, -117.857613481)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

7.1 Define selection and discuss its strategic importance.

Answered: 1 week ago