midterm_1_fall04

midterm_1_fall04 - shares of this stock at any day i 1 ≤...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
CS570 Analysis of Algorithms Fall 2004 Midterm
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1) Briefly describe the following algorithm techniques. (20 pts) a) Greedy method b) Dynamic programming c) Divide and conquer What is the commonality between the two approaches of dynamic programming and divide and conquer? What is the fundamental difference between divide and conquer and dynamic programming?
Background image of page 2
2) Suppose that a graph G has a minimum spanning tree already computed. How quickly can the MST be updated if a new vertex and incident edges are added to G. (20 pts)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
3) Give an example of a directed graph with negative weight edges for which Dijkstra’s algorithm produces incorrect answers. Identify the node(s) to which Dijstra’s algorithm incorrectly finds the shortest path. Explain why. (20 pts)
Background image of page 4
4) Consider the following scenario, you are given all the daily closing prices of shares of Microsoft over a period of n days. You are given a chance to buy 100
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7
This is the end of the preview. Sign up to access the rest of the 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 s-t cut in this flow network, what is the capacity of this cut? c) Is the minimum s-t cut unique, i.e. are there other s-t 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 Ford-Fulkerson algorithm may not terminate. Explain the reason why the algorithm may not terminate...
View Full Document

Page1 / 7

midterm_1_fall04 - shares of this stock at any day i 1 ≤...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online