Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 4: Finding a cheap flight. Let G = (V, E) be a directed graph, where V is a set of cities, and E represents

image text in transcribed

Problem 4: Finding a cheap flight. Let G = (V, E) be a directed graph, where V is a set of cities, and E represents all possible flights between the cities in V. For every edge {u, V} E E, you are given the duration of a direct flight from u to v, denoted by d(u, v), which is an integer. For example, if you are at city u at time t, and you take a direct flight to v, departing at time t' > t, then you arrive at v at time t' + d(u, v). For every {u, v} E E, you are given a timetable of all available direct flights from u to v, for some interval {0, ...,T}, where T > 0 is an integer. That is, for any {u, v} E E, you are given a list of pairs of integers ((tu,v,l, Cu,v,1), ..., (tu,v,k, Cu,v,k)), where the pair (tu,v,i, Cu,v,i) denotes the fact that there is a direct flight from u to v that departs at time tu,v,i, and costs Cu,v,i dollars. Design an algorithm that given a pair of cities u, V EV, computes the cheapest possible route that starts at u at time 0, and ends at v at time at most T. Prove that your algorithm is correct, and that its running time is polynomial in V and T. Hint: Express the above problem as shortest-path computations in some graph. Problem 4: Finding a cheap flight. Let G = (V, E) be a directed graph, where V is a set of cities, and E represents all possible flights between the cities in V. For every edge {u, V} E E, you are given the duration of a direct flight from u to v, denoted by d(u, v), which is an integer. For example, if you are at city u at time t, and you take a direct flight to v, departing at time t' > t, then you arrive at v at time t' + d(u, v). For every {u, v} E E, you are given a timetable of all available direct flights from u to v, for some interval {0, ...,T}, where T > 0 is an integer. That is, for any {u, v} E E, you are given a list of pairs of integers ((tu,v,l, Cu,v,1), ..., (tu,v,k, Cu,v,k)), where the pair (tu,v,i, Cu,v,i) denotes the fact that there is a direct flight from u to v that departs at time tu,v,i, and costs Cu,v,i dollars. Design an algorithm that given a pair of cities u, V EV, computes the cheapest possible route that starts at u at time 0, and ends at v at time at most T. Prove that your algorithm is correct, and that its running time is polynomial in V and T. Hint: Express the above problem as shortest-path computations in some 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

Database Design And Implementation

Authors: Shouhong Wang, Hai Wang

1st Edition

1612330150, 978-1612330150

More Books

Students also viewed these Databases questions

Question

Explain the concept of non monetary rewards.

Answered: 1 week ago

Question

=+ (e) The probability in Problem 2.15.

Answered: 1 week ago

Question

How autonomous should the target be left after the merger deal?

Answered: 1 week ago