Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

9. Running on empty. In this problem, we want to determine how to drive a car from point s to point t without running out

image text in transcribed

9. Running on empty. In this problem, we want to determine how to drive a car from point s to point t without running out of gas. Our car has a gas tank that is initially filled up to its capacity c. We may have to stop to refuel along the way: we can never allow the amount of gas in the tank to become negative, and we can never fill our tank beyond its capacity. Let us model this problem using a directed graph G (V, E) with non-negative edge weights wt : E R20, along with nodes s,te V. For an edge (u, v) e E, wt(u, v) represents the amount of gas required to drive from u to v. Also, a subset F C V represents those points where we may stop to refuel (assume each node v is marked with a bit f(v) indicating whether there is a gas station located at v). Give an efficient algorithm to solve this problem. Your algorithm should determine if there is a viable path from s to t, and if so, output a path that uses the minimum amount of gas. The running time of your algorithm should be O(IFIIVI +E1) log VI) Hint: use Dijkstra's shortest path algorithm as a subroutine. You wll have to call this subroutine many times. 9. Running on empty. In this problem, we want to determine how to drive a car from point s to point t without running out of gas. Our car has a gas tank that is initially filled up to its capacity c. We may have to stop to refuel along the way: we can never allow the amount of gas in the tank to become negative, and we can never fill our tank beyond its capacity. Let us model this problem using a directed graph G (V, E) with non-negative edge weights wt : E R20, along with nodes s,te V. For an edge (u, v) e E, wt(u, v) represents the amount of gas required to drive from u to v. Also, a subset F C V represents those points where we may stop to refuel (assume each node v is marked with a bit f(v) indicating whether there is a gas station located at v). Give an efficient algorithm to solve this problem. Your algorithm should determine if there is a viable path from s to t, and if so, output a path that uses the minimum amount of gas. The running time of your algorithm should be O(IFIIVI +E1) log VI) Hint: use Dijkstra's shortest path algorithm as a subroutine. You wll have to call this subroutine many times

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

Intelligent Image Databases Towards Advanced Image Retrieval

Authors: Yihong Gong

1st Edition

1461375037, 978-1461375036

More Books

Students also viewed these Databases questions

Question

Give some of the differences between law and equity.

Answered: 1 week ago

Question

What are the major global trends your industry faces?

Answered: 1 week ago

Question

Distinguish between poor and good positive and neutral messages.

Answered: 1 week ago

Question

Describe the four specific guidelines for using the direct plan.

Answered: 1 week ago