Homework 5

[Note: this webpage last modified Wednesday, 16-Mar-2011 08:56:40 EDT]

This homework assignment is due before class starts on Thursday, March 3. Your solutions should be explained in complete sentences such that your classmates will understand the solution (and can verify your proofs are correct) even if they have not solved the problems themselves.

  1. HW Polices.

    1. Type your HW (in word, latex, text file, etc.) and send to me by email.

    2. Do NOT share electronically. You must type your own solutions. You can discuss the problems with each other, but you may only discuss them. You may not write out solutions together.

    3. You MAY NOT search the Internet, textbooks, etc. for solutions to the problems. The following are the ONLY sources of information that you may use in solving the problems: the textbook for this course, wikipedia articles on basic math/probability/etc., and mathematical review material at the following MIT opencourseware page: 6.042J / 18.062J Mathematics for Computer Science, Fall 2005. You may discuss the problems with each other and with myself, but must obey the previous item in doing so.

      If you do find the solution in one of these three sources, you still MUST cite the source in your document.

      You may use NOTHING ELSE that is online or other textbooks.

    4. You MAY NOT copy word-for-word from any source, even the three you are allowed to consult. If you feel it is necessary, you should put the quotation in quotes and provide a reference/citation.

  2. (-2 points if left blank) List who you collaborated with on this assignment, "none" if none.

  3. (5 Points) For each of the following two algorithms, explain how much time and memory space are used by the algorithms. The first algorithm is breadth-first search for determining whether two vertices in a graph are connected. The second algorithm decides if a given graph has a clique of size at least k.

          Connected(G, s, t) {
            for each neighbor v of s in G {
              if (v has not been marked yet in our search) {
                mark v as having been visited in G.
                if (Connected(G, v, t)) {
                  return true.
                }
              }
            }
            return false.
          }
        

          Clique(G, k) {
            for each subset V' of k vertices of G {
              if (V' is a clique) {
                return true.
              }
            }
            return false.
          }
        
  4. (5 Points) Let L be a language that can be decided by a regular expression (equivalently, L can be decided by a DFA or NFA). What is the time-complexity of deciding if a given input x is in L? Why? What is the space-complexity of deciding if x is in L? Why?

    I suggest you take a few examples of DFA's or regular expressions and write pseudocode to solve the problem. Look at how much time and memory your pseudocode uses, and then describe how this generalizes to all DFA's or regular expressions.

  5. (Extra credit, 2 Points) Show that if NP=coNP then Sigma2 = NP = coNP. Remember that for a language L in Sigma2, there is a poly-time "verifier" such that x is in L if and only if: there exists a poly-length y such that for every poly-length z, V(x, y, z)=1. Sigma2 can also be thought of as languages that have verifiers like in the definition of NP, except that the verifier is allowed to get free answers to NP problems. You can use either formulation of Sigma2 to solve this problem.

    Note. In fact, it holds that if NP=coNP then all of the polynomial hierarchy is equal to NP. You do not need to show this, just FYI.

    Note. It may be easier to think first about what happens when P=NP, and then think about what happens if NP=coNP. If P=NP then Sigma2 = P.