Starting from:

$29

CSCI 570  - HW 4

CSCI 570  - HW 4

1 Graded Problems
1. Suppose you were to drive from USC to Santa Monica along I-10. Your
gas tank, when full, holds enough gas to go p miles, and you have a map
that contains the information on the distances between gas stations along
the route. Let d1 < d2 < ... < dn be the locations of all the gas stations
along the route where di
is the distance from USC to the gas station. We
assume that the distance between neighboring gas stations is at most p
miles. Your goal is to make as few gas stops as possible along the way.
Give the most efficient algorithm to determine at which gas stations you
should stop and prove that your strategy yields an optimal solution. Give
the time complexity of your algorithm as a function of n.
2. Consider the following modification to Dijkstras algorithm for single source
shortest paths to make it applicable to directed graphs with negative edge
lengths. If the minimum edge length in the graph is −w < 0, then add
w + 1 to each edge length thereby making all the edge lengths positive.
Now apply Dijkstras algorithm starting from the source s and output the
shortest paths to every other vertex. Does this modification work? Either
prove that it correctly finds the shortest path starting from s to every
vertex or give a counter example where it fails.
3. Solve Kleinberg and Tardos, Chapter 4, Exercise 3.
4. Solve Kleinberg and Tardos, Chapter 4, Exercise 5.
2 Practice Problems
1. Solve Kleinberg and Tardos, Chapter 4, Exercise 4.
1
2. Solve Kleinberg and Tardos, Chapter 4, Exercise 8.
3. Solve Kleinberg and Tardos, Chapter 4, Exercise 22.
2

More products