Practice Midterm for CMPSCI 611, Fall 2005

# Practice Midterm Exam

### Directions:

• Answer the problems on the exam pages.
• There are five problems for 100 total points. Probable scale is A=90, B=60.
• If you need extra space use the back of a page.
• No books, notes, calculators, or collaboration.

```  Q1: 20 points
Q2: 25 points
Q3: 15 points
Q4: 20 points
Q5: 20 points
```

• Question 1 (20): Let G be an undirected graph with edge set E. For each of the following families I of subsets of E, either prove that (E,I) is a matroid or give an example of a G such that (E,I) is not a matroid.

• (a,10) I = {X: X is a set of edges that contains no triangle} (A triangle is a set of three edges {(u,v), (u,w), (v,w)} where u, v, and w are distinct vertices.)

• (b,10) I = {X: X contains no path from s to t} where s and t are fixed distinct vertices of G.

• Question 2 (25): Let G be a directed graph with distinct specified vertices s and t. We know that if we make G into a flow network N by setting the capacity of each directed edge to 1, then there is a flow of size k in N iff there is a set of k edge-disjoint paths from s to t.

• (a,15) Describe how to build a flow network N' from G so that there is a flow of size k in N' iff there is a set of k vertex-disjoint paths from s to t in G.

• (b,10) Suppose that each vertex v other than s and t is assigned a non-negative integer h(v). Describe how to build a flow network N'' such that there is a flow of size k in N'' iff there is a set of k edge-disjoint paths from s to t in G, such that for each vertex v, no more than h(v) of the paths pass through v.

• Question 3 (15): Suppose that G is a weighted directed graph with n vertices and e edges, and that each weight is an integer in the set {1,...,n}. Describe an unweighted graph H, containing a vertex for each vertex of G plus perhaps more vertices, such that for any vertices s and t of G, the unweighted distance from s to t in H is the same as the weighted distance from s to t in H. Determine the time needed to solve the single-source shortest path problem in G by conducting a breadth-first search in H, in terms of n and e. Compare this time with the time required to solve the single-source shortest path problem in G by Dijkstra's algorithm.

• Question 4 (20): Let Σ be a finite alphabet and let N be a nondeterministic finite automaton with alphabet Σ. Specifically, Q is a set of n states and for every pair of states i and j, Aij is defined to be a subset of Σ -- the letters that allow N to go from state i to state j. Let A be the matrix whose (i,j) entry is Aij, thought of as a set of strings.

• (a,10) Suppose that we define "addition" of sets of strings to be the union operation, and "multiplication" to be concatenation of sets. That is, if X and Y are sets, then "XY" is the set {xy: x ∈ X and y ∈ Y}. Let k be a positive integer. Using the Path-Matrix Theorem, describe the set given by the (i,j) entry of the matrix Ak in terms of N.

• (b,10) How many bits of space might we need to carry out the computation of Ak, in terms of |Σ|, n and k?

• Question 5 (20): A groupoid is a set G, of n elements, and a arbitrary function from (G times G) to G. Let w = w1...wk be a sequence of k elements of G. Since the function need not be associative, we can "multiply out" w to get a single element of G in multiple ways, and need not get the same answer each time. (For example, a(bc) need not equal (ab)c.) Present and analyze an algorithm, whose running time is polynomial in n and k, to take as input both w and a multiplication table for G and output the set of possible products of w.