This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ze the complexity of your algorithm. 8 Sum of path weights [10 points] There is a directed acyclic graph whose node set is V and edge set is E. The weight on each edge of the graph is non‐negative. We deﬁne the weight of each directed path as the product of the weights of edges on the path. Design a O(|V | + |E|) algorithm to compute the sum of all the path weights from node v to node u. 9 Building bridges [10 points] Consider a 2‐D map with a horizontal river passing through its center. There are n cities on the southern bank with x‐coordinates a(1) ... a(n) and n cities on the northern bank with x‐coordinates b(1) ... b(n). You want to connect as many north‐south pairs of cities as possible with bridges such that no two bridges cross. When connecting cities, you can only connect city i on the norther...
View Full Document
- Spring '11