This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CAS 702 Final Exam Solution December 2007 1a. False. Let f ( n ) = 2 2 n . Then f ( n/ 2) = 2 n and we cannot find a constant c such that 2 2 n ≤ c 2 n . 1b. True. Use bucket sort, which is not comparison based, or any similar idea that works. 1c. True. If a node has two children, then it has left and right subtrees. As the result, its successor is the leftmost node in the right subtree and its predecessor is the rightmost node in the left subtree. 2a. Starting from the maxflow f , in each iteration, find a st(sourcetosink) path P i . Let the smallest edge weight along this path be w . Subtract the path flow f P i with value w from f . Note that the new flow has one less edge. Repeat the process until no more st paths can be found and the number of iterations is upperbounded by  E  . So we have f = ∑ i f P i and the number of f P i is no more than  E  . 2b,c. Define the supply of a source s as ∑ v ∈ V f ( s,v ) ∑ v ∈ V f ( v,s ). We use DFS to detect cycles and st simple paths in...
View
Full Document
 Fall '09
 Zera
 Graph Theory, ST path

Click to edit the document details