程序代写代做代考 graph algorithm go 1

1
1.
CSCI 570 – Fall 2020 – HW 4 Due September 23th
Graded Problems
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. ConsiderthefollowingmodificationtoDijkstra’salgorithmforsinglesource 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 Dijkstra’s 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. Solve Kleinberg and Tardos, Chapter 4, Exercise 3. Solve Kleinberg and Tardos, Chapter 4, Exercise 5. Solve Kleinberg and Tardos, Chapter 4, Exercise 8. 1 2. 3. 4. 5. 2 Practice Problems 1. Solve Kleinberg and Tardos, Chapter 4, Exercise 4. 2. Solve Kleinberg and Tardos, Chapter 4, Exercise 22. 2