ps10sol

# ps10sol - Introduction to Algorithms Massachusetts...

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Introduction to Algorithms Massachusetts Institute of Technology Singapore-MIT Alliance Professors Erik Demaine, Lee Wee Sun, and Charles E. Leiserson Day 41 6.046J/18.410J SMA5503 Handout 37 Problem Set 10 Solutions MIT students: This problem set is optional and need not be turned in. Solutions will be available one week later. Reading: Chapters 26 You will often be called upon to "give an algorithm" to solve a certain problem. Your write-up should take the form of a short essay. A topic paragraph should summarize the problem you are solving and what your results are. The body of your essay should provide the following: 1. A description of the algorithm in English and, if helpful, pseudocode. 2. At least one worked example or diagram to show more precisely how your algorithm works. 3. A proof (or indication) of the correctness of the algorithm. 4. An analysis of the running time of the algorithm. Remember, your goal is to communicate. Graders will be instructed to take off points for convoluted and obtuse descriptions. Exercise 10-1. Do exercise 26.1-5 on page 650 of CLRS. Solution: For one solution is . For but . are of course possible. Exercise 10-2. Do exercise 26.1-9 on page 650 of CLRS. Solution: Streets are edges, corners are vertices, house is source, school is sink, all capacities are 1, and you want to know if there is a flow of value 2. ) R%\$#65`6#@SQ HIGB FE A 3#@2D5CB#@ ) 0('&%!\$#" ! . one solution is . Other choices for XYPGVU %\$#" SRQP W T T ) 7 9386543\$#21 and and and 2 Exercise 10-3. Do exercise 26.2-3 on page 663 of CLRS. Solution: Handout 37: Problem Set 10 Solutions is the minimum cut for the flow. Augmenting paths (c) and (d) cancel flow previously shipped by (b) and (a) respectively. Exercise 10-4. Do exercise 26.2-5 on page 663 of CLRS. Solution: Any flow in the single-source single-sink network corresponds to a flow in the multisource multisink network with the same flow. Since any flow in the multisource multisink network is finite, so is any flow in the single-source single-sink network. Alternatively, a cut can be constructed separating all the sources from all the sinks. Only edges from the original network cross the cut. Thus the capacity of the cut is finite and any flow in the single-source single-sink network is finite. Exercise 10-5. Do exercise 26.2-8 on page 664 of CLRS. Solution: ) v Let be a maximum flow on . Either or there is some edge such that . There is some augmenting path that contains (or else is not a flow). Augmenting along results in a new graph with maximum flow . is on one more edge than is . Thus after such augmentations the resulting graph can no longer be augmented, and the algorithm terminates. v v x ) v 1ywp5 du T ( T H ) E v u 5G%p HsrcE Hicfcd cFE G#thgpq8Yphg&ebGa ...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online