Question: Problem 2 . Highway Driving ( 2 6 points ) You are given a set of cities, along with the pattern of highways between them,
Problem Highway Driving points
You are given a set of cities, along with the pattern of highways between them, in the form
of an undirected and connected graph Each stretch of highway einE connects
two of the cities, and you know its length in miles, length You want to get from city
to city There is one problem: your car can only hold enough gas to drive miles. There
are gas stations in each city, but not between cities. Therefore, you can only take a route if
every one of its edges has length length
a points Given the limitation on your car's fuel tank capacity, show how to determine
in linear time whether there is a feasible route from to
b points You are now planning to buy a new car, and you want to know the minimum
fuel tank capacity that is needed to travel from to Give an time
algorithm to determine this.
c points Instead you upgraded and bought a car with an unlimited fuel tank capacity,
however, now you don't have much money left, and so you need to get from to as
cheaply as possible. Unfortunately, not only do you have to pay for gas, but cities have
instituted a new tax for any car that enters. Specifically, let tax be the tax charged to
enter city vinV. For simplicity, you can assume the cost of the gas consumed to travel
on highway einE is exactly length Give an time algorithm to find the
cheapest route from to ie the route minimizing the sum paid for gas and taxes
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
