This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: shares of this stock at any day i, 1 ≤ i ≤ n and sell at any day j, i ≤ j ≤ n. Of course your objective is to maximize your profit in this transaction. There is a simplistic O(n 2 ) algorithm that tries all possible pairs of buy/sell days to find the optimal solution. Develop an algorithm that accomplishes this in O(n) time. (20 pts) 5) Consider the following flow network. (20 pts) a) What is the maximum value of an (s,t) flow in the above flow network? b) Identify a minimum st cut in this flow network, what is the capacity of this cut? c) Is the minimum st cut unique, i.e. are there other st cuts in this graph with same capacity? 6 s a c b d t 4 3 2 3 5 6 7 2 d) Give an example of a network with real numbers for edge capacities (as opposed to integer numbers) where the FordFulkerson algorithm may not terminate. Explain the reason why the algorithm may not terminate...
View
Full
Document
 Spring '08
 SHAHRIARSHAMSIAN
 Algorithms, Dynamic Programming, C Programming, Shortest path problem, Dijkstra, minimum st cut

Click to edit the document details