CSCI 256
Design and analysis of algorithms
Assignment 11

Due Monday, 4/30/2001


Only turn in problems from the second section.

Practice problems:

  1. Problem 27.2-1 on page 599 of the text.

Problems to be turned in:

  1. You head a major political party in the 2004 presidential election. Once again there are problems in Florida. You desperately need to get as many lawyers from New York to Tallahassee as you can by the end of the day. You have a schedule F of n flights available to you today. An entry Fi in this schedule is described by five values Fi = (si, ti, di, ai, ci):

    Give an efficient algorithm that will find a way to get the most lawyers as possible from new York to Tallahassee via airplane. You may assume that all flights run precisely on time (hah!), and that transfers between flights are instant (i.e., if ai ¾ di then it is possible for one lawyer to take flight i and then flight j). Be sure to argue correctness and analyze the running time of your algorithm.

    Hint: Transform the schedule into a max-flow instance, then solve the max-flow instance. Let the nodes be pairs of cities and times. Flights give some of the edges, but others arise from nodes representing the same cities, but different times. In your solution, be sure to describe the flow network carefully and illustrate it with an example. You may use any max-flow algorithm as a black box.

  2. In the midterm you learned how to set up a round-robin tournament. Now we'd like to rank the players. Assume that a round-robin tournament is played among n players. That is, each player plays once against all n-1 other players. There are no draws, and the results of all games are given in a matrix. It is not possible in general to sort the players, since A may beat B, B may beat C, and C may beat A (in other words, the results are not necessarily transitive). We are interested in a "weak" sorting as follows. Design an algorithm to arrange the players in an order P1, P2, ..., Pn such that P1 beat P2, P2 beat P3, and so on (concluding with Pn-1 beating Pn) given the matrix of results. The worst-case running time of the algorithm should be O(n lg n). (You may assume that any entry in the matrix can be accessed in constant time.) Hint: Think divide and conquer. Also note that the solution to this problem does not depend on anything covered recently in class. (I assigned it as a warm-up for the next problem!)

  3. Consider the preceding problem in this assignment (ranking the players in a round-robin tournament).

    1. Show that any algorithm for the ranking players problem can be used to sort n numbers. Thus sorting reduces to the ranking players problem. Hint: Interpret the ordering of the numbers as giving the results of playing a "match" between the two numbers.

    2. Use the results of part (a) to show that Omega(n lg n) is a lower bound for the time of any algorithm to solve the ranking players problem on a set of n players. Hint: Suppose you could solve the ranking players problem in time less than n lg n, what would that tell you about a lower bound for sorting.


    Back to:

  4. CS256 home page
  5. Kim Bruce's home page
  6. CS Department home page
  7. kim@cs.williams.edu