CS432: Practice Questions Set #1 on Chap. 10

1) Name two decision problems known to be in P.
Answer: If you convert any problem known to be in P into a decision problem, it's also in P.
Examples:

2) Name a decision problem known not to be in P.
Answer: You might think that any of the NP-complete decision problem are right answers here. But, we don't know! P may be equal to NP.

3) Name two problems known to be in NP (using at most one answer from (1) above).
Answer: any problem in P or any problem in NP-c -- these are both subsets of NP.


4) Name a problem known to be in NP but not in NP-hard.
Answer: "Common" problems in P that are not in NP-c are valid answers here. So the answers to question (1) work here too.


5) Name two problems known to be NP-complete.
Answer: SAT, CNF-SAT, 3-CNF-SAT, k-COL, VertexCover, k-Clique, SubsetSum, 0/1-Knapsack, HamPath, HamCycle, TSP, Tetris, Minesweeper


6) Explain the difference between a decision problem and its related optimization problem. Using graph coloring, explain what is the difference is between finding an optimal value and an optimal solution.

Answer: A decision problem determines if a graph has a particular property. Optimization problems have related decision problems, often because we add an additional input (often called k) that serves as a bound to the value of a "good" solution. So for graph coloring, the decision problem is k-COL(G, k), which asks if G has a valid coloring with k or fewer colors. If you could solve the decision problem, you could solve the optimal value problem. For graph coloring, this asks what's the minimum number of colors needed to color the graph, i.e. what is the graph's chromatic number. You could solve this by just repeatedly call the decision problem with increasing values of k. The optimal solution would be result that produces the optimal value; in the case of graph coloring, a mapping of colors to vertices using the minimum number. Finding this seems like it might be a little more work than just finding the value. But clearly the decision problem is perhaps the easiest of these 3 "flavors" to solve. So, if we prove a decision problem has an exponential lower bound, so do all the others.


7) Give a clear definition of a non-deterministic algorithm.
Answer: (See the textbook around pages 440-441, or the slides to get the full story.)
An algorithm that uses non-determinism to either (a) create a certificate s or (b) make a guess for a needed partial result.

8) Explain the definition of the class of problems NP, explaining how a non-deterministic algorithm is used (and when, and how often).

Answer: A decision problem A belongs to NP if it can be solved by a non-determinstic in polynomial time. This means that the non-deterministic algorithm (see previous answer) requires polynomial time to (a) check the certficate and the input together to determine if the input should be accepted or rejected, or (b) it could carry out the right sequence of guesses that would allow it to accept any input that should be accepted.


9) What is the significance of the class NP? For what reason did computer scientists define it?
Answer: We wanted to talk about the "hardest" problems, but hardest of what set? We need a "universe" of problems first, and NP is thus intended to include almost all of the kinds of problems we'd like to solve. Thus it's intended to include many many problems.


10) What is a reduction (or transformation) between two problems? Explain this assuming that Problem A takes input a_in and Problem B takes input b_in.

Answer: A reduction from Problem A to Problem B is a algorithm T(x) that transforms the input for Probem A, a_in, into an input for Problem B, b_in, in a way that a_in is accepted for Problem A if and only if b_in is accepted for Problem B. (In other words, the answer for both decision problems would be the same for a_in and b_in.


11) When we have shown that A reduces to B, we often then say that B is "at least as hard" as A, or that A is "no harder to solve" than B, does this make sense? If so, what do we mean by these statements?
Answer: We mean that if A is exponential, then B is exponential and B can't be polynomial.

12) What is the definition of NP-complete? If you had to explain this to a first-year computer science student, how would you say this in words (without giving the formal, mathematical definition)?
Answer: If problem A is NP-c, then it must be in NP and it must be NP-hard. To be NP-hard, any other problem in NP must be polynomial reducible to A.
To explain this to a first-year, you might say that these are a set of problems that are the hardest kinds of problems to solve, and that they *seem* to need exponential time. They're in an equivlance class where if any one of them has an effiicent solution, they all do, and if one is truly exponential, they all are.

13) What is Cook's Theorem? What is its significance?
Answer: The theorem states that the problem satifiability problem (SAT) belongs to NP-complete. Its significance is that it was the first problem proved to be NP-c, and Steven Cook proved this by showing directly that any problem beloing to NP could be transformed into an instance of SAT.

14) Describe the following problem in terms of its input and what question it tries to answer: k-COL
15) Describe the following problem in terms of its input and what question it tries to answer: Vertex-Cover
16) Describe the following problem in terms of its input and what question it tries to answer: SAT
17) Describe the following problem in terms of its input and what question it tries to answer: k-CLIQUE

NOTE: See slides or the text for answers to 14-17. But email us if you have questions.

18) For the problem you answered in 14-17, what would you have to do to show that the problem belongs to NP?
Answer: Define a non-deterministic algorithm for the problem and show it runs in polynomial time. Your algorithm either guesses a correct response step-by-step (the book's approach) or write a certificate (something related to a solution) and then checks it. Both guessing the right step or writing out a correct certificate are non-deterministic, but we assume they are polynomial here.

To show this for a particular problem, here is the answer using #14:

Problem k-COL
Inputs: graph G, int value k
Output: yes, if the graph has a valid coloring that uses k or fewer colors. Otherwise, no.
------------------------------------
How to show the k-COL belongs to NP?
Show an non-deterministic algorithm for this that runs in polynomial time.

Pseudocode:
check-k-Col(G, k) {

  // phase 1: generate certificate (a possible valid coloring)
  s = GetColoring(G); // non-deterministic!
  // assume s is an array s[1..n] of int, where each is a
  //   color value for vertices 1..n

  // phase 2: check s to see if it's a valid k-coloring for G
  //    n is |V|, number of vertices in G, and m is |E|, number of edges
  for (v=1; v<=n; ++v) {  // for each vertex v in G
     for each vertex w adjacent to vertex w {
         if (s[v] == s[w]) return false;
     }
   }
   if (number of unique colors in s[] > k ) return false;
   // passes all checks
   return true;
}

Is this polynomial?
Phase 1 is, since we assume s[] is of length n. Cost Theta(n) to write it out.
Phase 2 is, since this checks each edge in the graph. Theta(m).

19) Name a decision problem that we know requires exponential time to solve. Name a problem that has been proven to have an exponential lower bound.
Answer: You might think that the problems in NP-c fit this description. But we don't know! It has not been proven that any problem in NP requires exponential time. (See later answers for more on this.)


20) Name one of the NP-c problems that have been solved in polynomial time.
Answer: none of them have been! (So far. It might be possible, but we don't think so.)


21) State an important, "open" question in computer science.
Answer: Does P = NP, or is P a proper subset of NP? This is equivalent to asking if all the NP-c problems require exponential time or if they can be solved in polynomial time.


22) Draw a Venn diagram showing P, NP, NP-c, and NP-hard if P==NP.
Answer: This is the diagram I put on the board where the circle representing NP also represents P. NP-c is still a problem subset of NP.

23) Draw such a Venn diagram if P != NP.
Answer: This is the diagram I put on the board where the circle representing NP has two distinct subsets, P and NP-c.

24) If someone found a polynomial solution for a problem known to be in NP, what implications would that have for what we know about the P/NP situation?
Answer: This is a trick question -- since P is a subset of NP, there are lots of problems in NP that have polynomial solutions. So this tells us nothing about the P/NP situation.


25) If someone found a polynomial solution for a problem known to be in NP-hard, what implications would that have for what we know about the P/NP situation?
Answer: If a problem (call it A) belongs to NP-hard, then someone has proved there is a polynomial reduction between any problem in NP and A. Thus if we find a direct solution to A that is poynomial, then all problems in NP can be solved in polynomail time. Thus P == NP.

26) If someone found a polynomial solution for a problem known to be in NP-c, what implications would that have for what we know about the P/NP situation?
Answer: Same answer as 25, since NP-c problems are NP-hard.


27) How might one prove that P != NP? If someone did this, what would this tell us about problems in NP-c?
Answer: If someone showed there was an exponential lower bound for *any* one single problem A in NP (doesn't have to be in NP-c), then P != NP because there is at least one problem in NP that is not in P.
If there is any problem in NP that requires exponential time, then all NP-c problems are exponential -- they are the "hardest" of the NP problems. You can argue this by contradiction. If A has a exponential lower-bound, and B is a problem in NP-c, then B cannot be polynomial because by the definition of NP-c there must be a polynomial transformation T(x) that would allow you to solve A in polynomial time if B was polynomial. So B must be exponential, and this will be true of any problem B belonging to NP-c.


28) Choose one of the following polynomial reductions and discuss how it works:
a. 3-CNF to k-CLIQUE
b. HamCycle to TSP
c. DirectedHamCycle to UndirectedHamCycle

Answer: See the slides. If you have questions, ask or email!