Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Molly is planning a roadtrip to visit her grandfather. The road system she is travelling on is given by a directed graph G with
Molly is planning a roadtrip to visit her grandfather. The road system she is travelling on is given by a directed graph G with her initial location at a vertex s and final destination a vertex t. Each edge e of G has associated to it a positive integer r(e), which is the number of days that it will take Molly to travel along this edge. Molly wants to do some sightseeing on this trip and so also associates another value V(e) to each edge proportional to the value to her of traversing this edge. (a) Suppose that Molly needs to arrive at her grandfather's after exactly k days. Provide an algorithm to determine the greatest total value of any path with this traversal time. For full credit, your algorithm should run in time O(k(|V|+|E|)) or better. [20 points0 (b) Suppose instead that Molly is allowed to spend as much time as she wants travelling, but instead wants to optimize the average value per day of travel. For any real number x, give an algorithm to determine whether or not there is a path that allows Molly to reach her grandfather with an average value per day of travel of at least x. For full credit, your algorithm should run in time O(|V||E|). [20 points] (c) As in part (b), assume that Molly is trying to optimize her average value. Suppose that all edge values are between 0 and 1. Give an algorithm that given an > 0 approximates the best average value Molly can achieve to within error at most e in time O(|V||E| log(2/e)). [10 points] [Note: For all of these algorithms we will need to make the slightly unrealistic assumption that Molly is allowed to traverse the same edge multiple times, getting the same value from it each time.]
Step by Step Solution
★★★★★
3.41 Rating (164 Votes )
There are 3 Steps involved in it
Step: 1
a To find the greatest total value of any path that allows Molly to reach her grandfather in exactly ...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