ps6sol - Introduction to Algorithms Massachusetts Institute...

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

View Full Document Right Arrow Icon
Introduction to Algorithms November 15, 2004 Massachusetts Institute of Technology 6.046J/18.410J Professors Piotr Indyk and Charles E. Leiserson Handout 26 Problem Set 6 Solutions Reading: Chapters 22, 24, and 25. Both exercises and problems should be solved, but only the problems should be turned in. Exercises are intended to help you master the course material. Even though you should not turn in the exercise solutions, you are responsible for material covered in the exercises. Mark the top of each sheet with your name, the course number, the problem number, your recitation section, the date and the names of any students with whom you collaborated. 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 the essay should provide the following: 1. A description of the algorithm in English and, if helpful, pseudo-code. 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. Full credit will be given only to correct algorithms which are which are described clearly . Convoluted and obtuse descriptions will receive low marks. Exercise 6-1. Do Exercise 22.2-5 on page 539 in CLRS. Exercise 6-2. Do Exercise 22.4-3 on page 552 in CLRS. Exercise 6-3. Do Exercise 22.5-7 on page 557 in CLRS. Exercise 6-4. Do Exercise 24.1-3 on page 591 in CLRS. Exercise 6-5. Do Exercise 24.3-2 on page 600 in CLRS. Exercise 6-6. Do Exercise 24.4-8 on page 606 in CLRS. Exercise 6-7. Do Exercise 25.2-6 on page 635 in CLRS. Exercise 6-8. Do Exercise 25.3-5 on page 640 in CLRS.
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Handout 26: Problem Set 6 Solutions Problem 6-1. Truckin’ Professor Almanac is consulting for a trucking company. Highways are modeled as a directed graph G = ( V, E ) in which vertices represent cities and edges represent roads. The company is planning new routes from San Diego (vertex s ) to Toledo (vertex t ). (a) It is very costly when a shipment is delayed en route. The company has calculated the probability p ( e ) [0 , 1] that a given road e E will close without warning. Give an efficient algorithm for finding a route with the minimum probability of encountering a closed road. You should assume that all road closings are independent. Solution: To simplify the solution, we use the probability q ( e ) = 1 p ( e ) that a road will be open. Further, we remove from the graph roads with p ( e ) = 1 , as they are guaranteed to be closed and will never be included in a meaningful solution. (Following this transformation, we can use depth first search to ensure that some path from s to t has a positive probability of being open.) By eliminating p ( e ) = 1 , we now have 0 < q ( e ) 1 for all edges e E . It is important to have eliminated the possibility of q ( e ) = 0 , because we will be taking the logarithm of this quantity later.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 10

ps6sol - Introduction to Algorithms Massachusetts Institute...

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

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