This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Introduction to Algorithms Massachusetts Institute of Technology Professors Shaﬁ Goldwasser and Silvio Micali November 14, 2003 6.046J/18.410J Handout 23 Problem Set 7
This problem set is due in class on Wednesday, November 26. Reading: Chapters 25.125.2, 26.126.3. There are ﬁve problems. Each problem is to be done on a separate sheet (or sheets) of threehole punched paper. 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. Problem 71. Shortest Paths Consider a given directed weighted graph in which all edge weights are positive. Suppose that you have already computed a distance matrix , where is the length of the shortest path from node to node .
@¦ 8¦ 5¦ $967643 %¦"£ '&$#! @ 3 ¢ ¨¦ ¤ ©§¥£ 3 @ ¢ ¡ (a) Give an algorithm that, on input from to that passes through both and .
8 @ 3 3 5 0£ 21)( A£ CB)( @ 3 8 algorithm that, on input and , outputs a shortest  path in , (c) Give an i.e. your algorithm should output a list of vertices such that .) Problem 72. AllPairs Shortest Paths
v A£ s7B)( ¡ @ Ued6baaa©Y6W4UT3 ¢ c8¦```¦X8¦V8 ¢ @ @¦ 3£ u$4t! A Q IG A£ SR4PHBE( Xg ¢ 8 ¦ X q 8£ R#26srPp#i ih c f Give an implementation of the F LOYD WARSHALL algorithm that uses Problem 73. Transitive Closure space. We deﬁne a directed graph to be edgeparsimonious if among all directed graphs with the same transitive closure as , graph has a minimum number of edges. (See CLR pages 632– 633 for a deﬁnition of transitive closure.)
¨ ¤£ xwt)( Given a directed acyclic graph , give an with the same transitive closure as .
¡ ¡ q ¡ algorithm that ﬁnds an edgeparsimonious graph Problem 74. Greedy Maximal Matching.
¨¦ ¤£ x6§¥y¡ ¢ Give a linear time algorithm that, on input graph half that of a maximum matching. , ﬁnds a matching with size at least ¤D FE8 algorithm that, on input and , outputs a list of all vertices (b) Give an that is on some shortest path from to . q ¡ % q q ¡ " , ﬁnds the length of the shortest path such ¡ 2 Problem 75. Flying Friends to San Francisco Handout 23: Problem Set 7 You are stuck in San Francisco and you want to ﬂy as many friends as possible from Boston to San Francisco to celebrate your birthday tommorrow. You have a schedule of ﬂights available to you today. An entry in this schedule is described by ﬁve values : = starting city = ending city = departure time = arrival time = number seats available
¦ ¦ ¦@¦ 3£ r$&4©¥4©&$tt
¢ A 3 r 4 4 &@ Give an efﬁcient algorithm that determines the maximum number of friends you can ﬂy from Boston to San Francisco in time for your birthday party using the ﬂights from schedule . You may assume that all ﬂights run precisely on time, and that transfers between ﬂights are instant (i.e., for ﬂights and and , then it is possible for one student to take ﬂight and if then ﬂight ). Be sure to argue correctness and analyze the running time of your algorithm. Hint: You might want to transform the schedule into a maxﬂow instance and then solve the maxﬂow instance. You may use any maxﬂow algorithm as a black box.
3 ©&@ ¢ i 2 ...
View
Full
Document
This note was uploaded on 01/01/2011 for the course CS 5503 taught by Professor Charlese.leiserson during the Fall '01 term at MIT.
 Fall '01
 CharlesE.Leiserson
 Algorithms

Click to edit the document details