Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Graph and sorting algorithms You are to write a C++ program that finds the driving direction of a specified initial and end location much like
Graph and sorting algorithms You are to write a C++ program that finds the driving direction of a specified initial and end location much like MapQuest or Google Maps. You are to read the map information from a text file and create a graph. Each intersection and point of interest in the map will be given a unique name and be a vertex in the graph. Each road connecting 2 intersections is an edge in the graph. The edge names do not need to be unique. Use a directed graph since some streets may be one- ways. The text file will look like: From Intersection Street To Intersection Speed Name Name Name Direction Distance Limit Alafaya&GeminiN Gemini Gemini&GreekParkCt East 35 Gemini&GreekParkCt Gemini Alafaya& GeminiN West 35 Gemini&GreekParkCt Gemini Gemini&KnightCtE East 35 Hikiwi Gemini&KnightCtE Gemini Gemini&GreekParkCt West 35 Gemini&KnightCtE KnightCt Arena North 20 Arena KnightCt Gemini&KnightCtW South 20 Steps: 1. Write a function to perform a Quick Sort or Merge Sort on a list of alphanumeric data. 2. Read the text file and add each intersection name to the list. Only read the first column since all intersection names will be in there. 3. Sort the list using the Quick Sort or Merge Sort algorithm 4. Copy the names from the sorted list into the graph. Omit duplicates. 5. Create the graph by reading the original map file and adding an edge for each street. Use a binary search algorithm to find the proper vertex in the graph. 6. In the main program ask the user to input a start and end intersection. 7. Find the shortest and quickest path from the start to the end intersection. The output should indicate the name of the street and the distance. The output should look like: From Alafaya&GeminiN Take Gemini East to Gemini&GreekParkCt Take Gemini East to Gemini&KnightCtE Take KnightCt North to Arena The shortest path is the path with the least mileage while the fastest path is the path with the least time. The time is the distance multiplied by the speed in MPH.Alafaya&Gemini Gemini Gemini &GreekPark East 0.2 35 Alafaya&Gemini Alafaya Alafaya&Centaurus South 0.35 45 Alafaya&Centaurus Alafaya Alafaya&Gemini North 0.35 45 Alafaya&Centaurus Centaurus Centaurus&Gemini East 0.1 35 Alafaya&Centaurus Alafaya Alafaya&University South 0.3 45 Centaurus&Gemini Gemini Aquarius &Gemini North 0.05 35 Centaurus&Gemini Centaurus Alafaya&Centaurus West 0.1 35 Centaurus&Gemini Gemini West Garage South 0.05 35 Aquarius &Gemini GreekPark Gemini &GreekPark North 0.3 30 Aquarius&Gemini Aquarius Aquarius&PegCirc East 0.4 30 Aquarius&Gemini Gemini Centaurus&Gemini South 0.05 35 Gemini &GreekPark Gemini Alafaya&Gemini Northwest 0.2 35 Gemini &GreekPark GreekPark Aquarius&Gemini Southwest 0.3 30 Gemini GreekPark Gemini Gemini KnightCt East 0.4 35 West Garage Gemini CentaurusGemini Northeast 0.05 35 West Garage Gemini Gemini &Lynx Southwest 0. 05 35 Gemini &Lynx Lynx LynxStation East 0.1 25 Gemini &Lynx Gemini WestGarage North 0. 05 35 Gemini &Lynx Gemin Gemini UniversitySouth 0.1 35 LynxStation Lynx Gemini &Lynx West 0.1 25 Gemini &University Gemini Gemini &Lynx Northwest 0.15 35 Gemini & University University Alafaya&University Southwest 0. 15 45 Gemini University Gemini Millican East 0.2 35 Alafaya&University Alafaya Alafaya&Centaurus North 0.3 45 Alafaya&University University Gemini &University Northeast 0.15 45 Millican Gemini Gemini &University West 0.2 35 Millican Gemini SouthGarage Southeast 0.1 3.5 SouthGarage Gemini Millican Northwest 0.1 35SouthGarage Gemini RecCenter South 0 . 25 35 EastGarage Gemini Gemini Orion North 0.2 35 EastGarage Gemini Gemini Libra South 0 . 45 35 RecCenter Gemini SouthGarage West 0 . 25 35 RecCenter Gemini Gemini &Libra East 0. 25 35 Gemini&Libra Gemini RecCenter Southwest 0 . 25 35 GeminiLibra Gemini EastGarage Northeast 0 . 45 35 Gemini &Libra Libra HealthCenter Northwest 0 . 15 25 Gemini Orion Gemini EastGarage South 0. 2 35 Gemini Orion Gemini Gemini KnightCt Northwest 0 . 1 35 Gemini KnightCt Gemini Gemini&Orion Southeast 0 . 1 35 Gemini KnightCt Gemini Gemini &GreekPark West 0. 4 35 GeminiKnightCt KnightCt Arena Northeast 0 . 1 25 Arena KnightCt Gemini KnightCt Southwest 0 . 1 25 Aquarius&PegCirc Aquarius Aquarius Gemini West 0.4 30 Aquarius&PegCirc PegasusCircle Union South 0 . 05 25 Union PegasusCircle Aquarius &PegCirc North 0 . 05 25 HealthCenter Libra Gemini &Libra Southeast 0 . 15 25
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