- Answer the problems on the exam pages.
- There are eight problems for 120 total points. Probable scale is A=105, C=70.
- No books, notes, calculators, or collaboration.
- The actual exam will have a time limit of 120 minutes.
- Questions 1 and 2 are "true/false with explanation" -- you get five points for a correct boolean answer, and up to five additional points for a convincing justification. There will probably be three or four such questions, rather than two, on the actual final (which will also be 120 total points).

Q1: 10 points Q2: 10 points Q3: 15 points Q4: 15 points Q5: 20 points Q6: 20 points Q7: 15 points Q8: 15 points Total: 120 points

**Question 1 (10):***True or false with justification:*Let A be an algorithm that operates on a list of n objects, where n is a power of two. A spends Θ(n^{2}) time dividing its input list into two equal pieces and selecting*one*of the two pieces. It then calls itself recursively on that list of n/2 elements. Then A's running time on a list of n elements is O(n).**Question 2 (10):***True or false with justification:*Let X be a decision problem. If we prove that X is in the class NP and give a poly-time reduction from X to 3-COLORING, we may conclude that X is NP-complete.**Question 3 (15):**Let G be an undirected graph with n vertices and m edges, given as an adjacency list. Each vertex has a postive integer

**value**, and one vertex is s designated as the**start point**. Our goal is to select one vertex v in the graph, travel to it, and collect its value minus the**cost**of traveling from s to v. In this problem the cost of traveling is 1 for each edge traversed.Describe an algorithm, running in O(n+m) time, to determine which vertex v maximizes our net reward. Explain why your algorithm takes O(n+m) time.

**Question 4 (15):**This question is the same as Question 3 except that now each edge has its own positive integer cost, and to travel to a node we must pay the sum of the edge costs for the edges we use. We are no longer required to find the best vertex in O(n+m) time.

Describe an algorithm to find the best vertex that uses a time that is

**polynomial**in n and m, no matter what integers are used for the edge and vertex costs. (You may assume that arithmetic on these costs takes only O(1) time per operation.) State and justify a polynomial bound on the running time of your algorithm.**Question 5 (20):**The

**Global Max-Cut**problem is a variation of the Max-Cut problem that we studied in connection with network flow. Our input is a**undirected**graph G with n vertices, m edges, and a positive integer weight on each edge. We want to find the largest possible cut (A,B) in G, where A and B are disjoint**non-empty**sets of vertices with A ∪ B = V (the set of all vertices). There are two differences between this problem and the Max-Cut problem we studied -- the graph is undirected, and there are no designated vertices s and t that must be on opposite sides of the cut.Give a deterministic (not randomized) algorithm to solve this problem in a time that is polynomial in m and n, whatever the weights on the edges. You may refer to the standard algorithms for the Max-Cut problem, but indicate exactly how you will use them to solve this problem given the differences noted above. State and justify a polynomial time bound on your algorithm.

*Note: This problem is solved in Section 13.2 of KT, which we didn't cover in lecture -- don't look there if you want to solve the problem yourself.***Question 6 (20):**This question and the two following refer to the

**Dominating Set**problem. In an undirected graph G, a dominating set is a set X of vertices such that every vertex in G is either*in*X or*connected to*a vertex of X by an edge, or both. The Dominating Set problem is to input an undirected graph and a number k, and determine whether there is a dominating set with k vertices.Prove that the Dominating Set problem is NP-complete. (Hint: Reduce from Vertex Cover by constructing a new graph from G.)

**Question 7 (15):**A dominating set X for a graph G is defined to be

**minimal**if no proper subset of X is a dominating set. Give a polynomial-time algorithm that inputs a graph G and outputs a minimal dominating set. Argue that your algorithm takes only polynomial time in n, the number of vertices in G.**Question 8 (15):**Let d be a positive integer and let G be an undirected graph with maximum degree d. Give a polynomial-time algorithm that produces a dominating set for G that is no more than d+1 times as large as the

*minimum*size dominating set. Argue carefully that your algorithm has this property.

Last modified 12 December 2006