This preview shows pages 1–2. Sign up to view the full content.
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 max-flow f , in each iteration, find a s-t(source-to-sink) 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 s-t 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 s-t simple paths in...
View Full Document
This note was uploaded on 10/26/2009 for the course CAS 702 taught by Professor Zera during the Fall '09 term at McMaster University.
- Fall '09