# CSCI 256 Design and analysis of algorithms Assignment 12

## Due Friday, 5/4/2001

Only turn in problems from the second section.

### Practice problems:

1. Illustrate how to use Ford-Fulkerson to find a maximal matching in the following bipartite graph:

2. Design a linear-time algorithm for finding a maximum matching in a tree. Hint: Think recursively and start with a leaf. Be sure to prove that you have a maximum matching and that it is linear time.

3. Let G be an undirected bipartite graph, and let M be an arbitrary matching in G. Construct an algorithm to find a maximum matching in G that covers all the vertices that M covers. (A vertex is covered by a matching M if it is incident to one of the edges of M.) Note that edges in M may be dropped in finding the maximal matching, you are only asked to show that vertices that were mentioned in the original M are also mentioned in the final matching. Hint: Look at how we found maximum matchings and examine the algorithm carefully. You may need to make minor modifications or restrictions to preserve vertices.

### Problems to be turned in:

1. Problem 27-3 on page 627.

Hints:
1. For part a, interpret the solution to part a as telling you that given a cut (S,T), if the node corresponding to an experiment is in T, then so are all of the nodes corresponding to the instruments needed to perform that experiment.

2. For part b, note that minimizing the value V of a cut is equivalent to maximizing the value of P - V for any T. Use this with P = sum of all of the pj to get an expression involving the net revenue for running the experiments in T (where (S,T) is the minimum cut).

3. You need not analyze the complexity of your algorithm, but do write out carefully the algorithm.

2. Let S1, ..., Sk be a collection of sets. A system of distinct representatives (SDR) is a set R = {r1, ..., rk} of distinct elements such that ri in Si, for all 1 <= i <= k. In other words, R includes exactly one representative from each set. It is not always possible to find an SDR of a given collection of sets. For example, there is no SDR for the collection of sets S1 = {1,2}, S2 = {2,3,4}, S3 = {1,3}, S4 = {1,2,3}, and S5 = {2,3}. However, if we leave off S5, the first four sets have SDR {1,4,3,2}.

Design an algorithm that, given a collection of sets, determines whether that collection has a SDR, and, if so, returns the SDR. Hint: Reduce this to the problem of finding a maximal matching of a bipartite graph G where L is a set of vertices with one vertex, vi, corresponding to each Si and R is a set of vertices with one vertex, vj, corresponding to each element ej in the union of the Si's.

Be sure to discuss the translation of input to appropriate input for the matching as well as the translation of the output to the appropriate answer for the SDR problem. What is the complexity of the algorithm?

Back to: