Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Algorithm E 5 Problem 1 (20 points) You are traveling with a rented car and you are given a map modelled by a weighted graph

Algorithm
image text in transcribed
E 5 Problem 1 (20 points) You are traveling with a rented car and you are given a map modelled by a weighted graph with n nodes and m edges, where the weights correspond to the time taken to travel between two cities. The edges are used to model ordinary roads and roads where you can change car and perhaps travel faster along that road. Your goal is to reach your destination as fast as possible with one restriction. You can switch a car at most once. When you switch, the time to travel along that road (but not the rest) reduces to half. See the graph alongside for an example. What is the best path from A to nodes C and D when you are allowed to switch car once? The problem can be solved using Dijkstra's algorithm, PROVIDED you model the problem appropriately. So, explain how to modify the graph to capture the problem's constraints and directly use Dijkstra's algorithm The more elegant your solution, the more points you will get. Notice that you are NOT allowed to modify Dijkstra's algorithm in any way. a) (5 pts) Explain how to solve the problem using Dijkstra's algorithm many times. What is the running time in this case? b) (10 pts) Show how to solve the problem using Dijkstra's algorithm only ONCE! What is the running time in this case? Give details about your construction and explain how the problem can be solved. Hint: You need to create a graph with 2n nodes and appropriate edges... c) (5 pts) Show your construction in part (b) for the example graph

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

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions

Question

=+a randomly selected cork will conform to specification?

Answered: 1 week ago