View the step-by-step solution to:

# Final Exam. Last moment due: 12/11/08 at 23:59 Remarks: Choose 4 of the following 5 questions. In all the answers always explain their correctness...

Recall that a palindrome is a string w such that w = wr. Write a
program for a TM that accepts palindroms

Final Exam. Last moment due: 12/11/08 at 23:59 Remarks: Choose 4 of the following 5 questions. In all the answers always explain their correctness (or prove it if necessary). Question 1: Recall that a palindrome is a string w such that w = w r . Write a program for a TM that accepts palindroms Question 2: Show that the following problems are in NPC 1. The minimum degree Spanning tree problem. A tree is a graph that has no cycles and is connected. A tree is spanning if it contains all vertices. The question is: given a graph G ( V, E ) and a degree bound b is there a spanning tree T ( V, E ) so that the degree in T of every vertex is at most b ? Hint: think of very small values of b Remark: you may assume that there is an algorithm that checks in polynomial time if a graph G ( V, E ) is a tree. 2. The Set-Cover question. Input: Given a universe U and a collection S 1 , S 2 , . . ., S m of subset S i U and a number k . Question: Is there a partial collection of at most k sets whose union is U ? Hint: think of vertex-cover 3. Given a graph G ( V, E ) and a number k the question is can we decompose V into a union of at most k disjoint sets V = k i =1 V i so that every V i is a clique, namely, every pair of vertices inside V i are neighbors? (Recall that vertex coloring is NPC) 4. This question deals with the dominating set problem (deFned in exercise III). Except that here vertices have a weight w ( v ) for every vertex. The question: is there a dominating set of sum of weights at most k ? Show that this problem is NPC. Hint: take the set cover problem and make the sets and elements vertices. Create a graph in a natural way adding edges between sets and elements (only). Then use the weights to allow choosing only sets. Question 3 In the following questions you have multiple choices answers. Whatever you choose, explain your answer (even if you got it wrong you may get partial credit) 1. Say that we are given that the graph isomorphism problem is NPC. Then this implies that: (a) P = NP (b) P n = NP 1
(c) None of the above 2. Say that we prove that NP n = Co NP then we can deduce that (a) P n = NP (b) P = NP (c) None of the above 3. Say that we are given a problem with output of 3 numbers a, b, c . Say that we can solve the problem in time (log a ) 2 + b 1 / 3 +2 log c time (steps). Then our algorithm is: (a) Polynomial in the input (b) Exponential in the input (c) non of the above 4. Say that we discover a polynomial time algorithm for the traveling sales person problem that runs in O ( n 9 ) time (the O notation ignores constants and low order terms). Then (a) The maximum independent set has an O ( n 9 ) time algorithm (b) Every problem in P is polynomially harder then the Maximum Clique prob- lem (c) Both of the above Question 4: Say that we are given an Oracle (namely not an algorithm) for the Halting problem. True or false? In such case there is a reduction from any recursive problem (language) to the Halting problem Question 5: Show the following problems are undecidable: 1. Given two TM and an input x , do the two Turing machine have the same output on x ? 2. Given a TM, does it halts on all but 6 inputs? 2
3. There is a polynomial time reduction from this problem to SAT 4. This problem is in NP III) Consider the problem: Given a graph, is it true that the problem has no Hamil- tonian path 1. If P = NP then this problem admits a polynomial algorithm 2. It is an open problem if this problem is in NP 3. If this problem admits a polynomial algorithm then P = NP 4. This problem is decidable Question 4: (I) A graph H is a subgraph of G if H can be derived from G by removing some vertices from G and all the edges of removed vertices, and also removing some edges of G . The Subgraph Isomorphism problem is given G and H , is H a subgraph of G 1. Show that the maximum clique problem is a special case of the Subgraph Isomor- phism problem. 2. Show that Hamiltonian path is a special case of Subgraph Isomorphism. 3. Is the Subgraph Isomorphism problem NPC? (II) Consider the question: given a Turing Machine T and an input x and a number k ( k may depend on T and x ) the question is if there is an algorithm to check if T halts on x in at most k steps. 1. Is this problem undecidable? 2. Is the problem in P ? 3. Is the problem in NP ? 4. Is it an open question if this problem belongs to NP ? (III) Consider the Subset Sum problem: Given a collection A of n integer numbers is there a a way to split A into B C = A , B C = so that the sum of numbers in B equals the sum of numbers in C ? Let a be the largest number in A . 1. If there exists an algorithm that solves the problem in time n 3 · a 1 / 4 then P = NP 2. If the problem admits n log n · (log a ) 10 time algorithm then P = NP 3. If there is an n 7 · (log a ) 12 algorithm for the problem then P = NP 4. If a n 4 then the problem is in P 2
Exercise IV Remarks: In all the answers always explain their correctness (or prove it if necessary). Question 1: Say about all these statements if they are true or not or are an open problem. Prove, or explain precisely your answer. 1. If P = NP then the Halting problem becomes decidable. 2. If NP 6 = Co - NP then P 6 = NP . Hint: think what is the complement of P 3. If we can solve the Hamiltonian path in time O ( n 4 ) then you can solve any other NPC problem in O ( n 4 ) time. 4. Say that the input contains 3 numbers a,b,c . Say that we have an algorithm for the problem that runs in time O (log 2 a ) + O ( b ) + O (log c ). Is this algorithm polynomial? Question 2: Answer yes or no and Prove or explain precisely why 1. NPC problems are decidable 2. There is a reduction from any NPC language to the halting problem. Hint: Say that you have the clique problem. The input is a graph and an integer k . There is a program that solves it in time about 2 n . Make the problem take an inﬁnite loop in the case of no instance and stop in the case of a yes instance 3. There is a reduction from any decidable language to the Halting problem. Question 3: Describe an algorithm (not a Turing machine but rather explain in words). We want to build a description of a Turing machine that accepts { 0 2 n | n 0 } . For example 0 is in the language for n = 0. also 00 for n = 1. For n = 2 we get that 0000 is in the language. Also 00000000 for n = 3. Hint: Go over the string and remove every second 0. And then return left. You have to check if the size of the string is not odd. Let me be clear: You should write an algorithm that says: Go over the list from left to right and remove every second 0, etc. Namely explain in words not build a Turing machine. You should note that if you understand the algorithm, making in a program for a Turing machine is a purely technical matter. Question 4: Is the following problem is decidable? Given a Turing machine M inputs x,y,z does M halts on these 3 instances? Hint: make y and z any two artiﬁcial inputs that the program stops with these inputs. 1

### Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

### -

Educational Resources
• ### -

Study Documents

Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

Browse Documents