Assigned:
Wed 02 Dec 2009
Due:
Wed 09 Dec 2009
Problem | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | ... |
---|---|---|---|---|---|---|---|---|---|---|
Credit | RC | RC | RC | EC | RC | RC | NA | RC | RC | ... |
where "RC" is "regular credit", "EC" is "extra credit", and "NA" is "not applicable" (not attempted). Failure to do so will result in an arbitrary set of problems being graded for regular credit, no problems being graded for extra credit, and a five percent penalty assessment.
Required: Do five of the six problems below.
Unless otherwise indicated, exercises and problems are from Introduction to Algorithms by Cormen, Leiserson, Rivest, and Stein. The edition (2nd or 3rd) will be indicated if the numbering differs. * - Indicates problem from Algorithms by Dasgupta, Papadimitriou, and Vazirani.
Input: Undirected graph G = (V,E) with unit edge lengths; nodes u, v ∈ V.
Output: The number of distinct shortest paths from u to v.
Input: Undirected graph G = (V,E) with edge lengths le > 0; an edge e ∈ E.
Output: The length of the shortest cycle containing e.
Suppose that in addition to having edge lengths {le : e ∈ E }, a graph also has vertex costs {cv : v ∈ V}. Now define the cost of a path to be the sum of its edge lengths, plus the costs of all vertices on the path (including the endpoints). Give an efficient algorithm for the following problem.
Input: A directed graph G = (V, E); positive edge lengths le and positive vertex costs cv; a starting vertex s ∈ V.
Output: An array cost[⋅] such that for every vertex u, cost[u] is the least cost of any path from s to u (i.e., the cost of the cheapest path), under the definition above.
Notice that cost[s] = cv.