Question: Problem 1 1 - 5 ( Reaching Far and High ) 1 1 points You are in charge of the Farther and Higher Mountain Guides
Problem Reaching Far and High points
You are in charge of the Farther and Higher Mountain Guides company. The company owns guest houses: one at NYCs Battery Park, and others at various locations in the Catskills. Each guest house # is at some altitude above sea level; all the heights are distinct numbers, and
satisfy A valid guided tour starts at the Battery Park guest house #which is at sealevel, ie and involves spending exactly one day each at some subset of guest houses, such that each guest house in the sequence is a at a higher altitude than the previous guest house, and b strictly further away from the starting guest house. You charge ci for a day at guest house i so you want to find a valid path that maximizes the total amount you charge the client. We now develop an algorithm to find such a path in On time.
a points Model the problem as finding a maximumweight path in a directed acyclic graph DAG with vertex weights. Make sure you argue that the graph has no directed cycles.
b points Give an algorithm to find the maximumweight path in a DAG G V E with m directed edges and n vertices. Your algorithm should run in Om n time.
Note: you should return the maximumweight path, and not just its length. Clearly indicate where you are using the acyclic property of the graph. Hint: use a graph algorithm you have seen in lecture, followed by dynamic programming.
c point Now we want to count the total number of directed paths in a DAG. A single vertex also counts as a path. And the weights are no longer relevant. So for instance, if the graph G consisted of edges v vv vvn vn show that the number of directed paths in G is nn
d points Now give an algorithm to output the total number of directed paths in a DAG. Again, show how to do this in time OnYou dont need to use any ideas from part c but be sure to check your algorithm on the example there.
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
