# Midterm Exam, Fall 2018

### Directions:

• Answer the problems on the exam pages.
• There are seven problems (some with multiple parts) for 100 total points. Actual scale was A = 93, C = 63.
• If you need extra space use the back of a page.
• No books, notes, calculators, or collaboration.

```  Q1: 10 points
Q2: 10 points
Q3: 10 points
Q4: 10 points
Q5: 20 points
Q6: 20+10 points
Q7: 10 points
Total: 100+10 points
```

For Questions 1-4, the graph G has node set {a, b, c, d, e, f} and nine edges: (a, b), (a, c), (a, d), (b, c), (b, e), (c, f), (d, e), (d, f), and (e, f). Recall that "graph" refers to an undirected graph with no self-loops.

• Question 1 (10): Find a graph with six nodes and nine edges that is not isomorphic to G. Prove that the two graphs are not isomorphic.

• Question 2 (10): Is G a planar graph? Prove your answer. What is the number of regions in a planar embedding of H, given by Euler's Formula?

• Question 3 (10): Does G have an Euler path and/or Euler circuit? Does H have a Hamilton path and/or Hamilton circuit? Justify your answers.

• Question 4 (10): What is the chromatic number of G? Prove your answer. (The chromatic number is defined to be the "vertex-chromatic" rather than the "edge-chromatic" number.)

• Question 5 (20): For this problem we will assume that the HAM-CIRCUIT problem is NP-complete, meaning that if there is a polynomial-time algorithm that inputs a graph and decides whether it has a Hamilton circuit, then P = NP. Here are two questions about related problems:

• (a, 10) The HAM-PATH problem is to input a graph and decide whether it has a Hamilton path. Prove that if there is a polynomial-time algorithm for HAM-PATH, then P = NP. (You may use the assumption about HAM-CIRCUIT. Hint (corrected): Apply the HAM-PATH tester to a different graph.)

• (b, 10) The LSP (Longest Simple Path) problem is to input a graph G and a number k, and decide whether G contains a simple path of k or more edges. (A simple path is one that never re-uses a node.) Prove that if there is a polynomial-time algorithm for LSP, then P = NP. You may use the assumption about HAM-CIRCUIT and the result of part (a), whether you solved part (a) or not.)

• Question 6 (20+10): In this problem we consider distributing n identical treats to four distinguished dogs: Ali (a), Bingley (b), Cardie (c), and Duncan (d), where each dog receives at least one treat. Let f(n) be the number of such distributions.

• (a, 10) Prove that for any n, f(n) is equal to the number of strings of length n - 4 over the alphabet {a, b, c, d}, where the individual letters come in alphabetical order. (That is, all the a's come before all the b's, the b's before the c's, and the c's before the d's. Another way to say this is to say that the string must be in the regular language a*b*c*d*.)

• (b, 10) Using part (a) or otherwise, find a formula for f(n) as a function of n. You may use ordinary arithmetic operations, the factorial operation, and the binomial coefficient operator C(x, y). Evaluate your formula for n = 3, n = 5, n = 7, and n = 9.

• (c, 10XC) Find the number of ways to distribute 13 treats to the four dogs such that each dog gets at least one treat and no two dogs get the same number of treats. (As before, the treats are identical and the dogs are distinguished.)

• Question 7 (20): The following are ten true-false questions, with no explanation needed or wanted, and no penalty for guessing. They count two points each. Some of the problems use the graph G with the following weights on the edges: (a, b, 1), (a, c, 1), (a, d, 1), (b, c, 2), (b, e, 2), (c, f, 3), (d, e, 4), (d, f, 4), and (e, f, 5).

• (a) If we take an undirected tree with n nodes, and change each edge to a pair of directed edges (in opposite directions), then the resulting directed graph has an Euler circuit of length 2n - 2.

• (b) Any correct comparison-based algorithm to find the median of n items can be interpreted as a decision tree with at least n! leaves.

• (c) It is not the case that every two nodes in the weighted version of graph G are within distance 5 of one another.

• (d) The minimum spanning tree in the weighted version of graph G has total weight 7.

• (e) Thre is a minimum spanning tree of the weighted version of graph G that does not contain the edge (c, f).

• (f) Let H be a flow network and let (X, Y) be a partition of the vertices of H such that the source is in X and the sink is in Y. Let f be a flow in H such that every edge from a vertex in X to a vertex in Y is saturated by f. Then f must be a maximum flow.

• (g) Let H be a flow network and let f be a flow in H such that for every vertex x in H except for the sink, there is at least one edge out of x that is not saturated by f. Then f cannot be a maximumm flow.

• (h) Let B be a bipartite graph, with n nodes in a set X, n nodes in a set Y, and every edge with one endpoint in X and the other in Y. There are n! bijections from X to Y, any of which might be a perfect matchingin B. Tucker presents no method for finding a perfect matching in B that is substantially faster than trying all n! of these bijections.

• (i) The number of anagrams of the work RHINOCEROS is C(10, 2) times C(8, 2).

• (j) The sum for i from 1 to n of C(n, i) is 2n.