This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CS 341: Foundations of Computer Science II Prof. Marvin Nakayama Homework 12 Solutions 1. (a) Show that NP is closed under union. Answer: Let L 1 and L 2 be languages in NP. Also, for i = 1 , 2 , let V i ( x, c ) be an algorithm that, for a string x and a possible certificate c , verifies whether c is actually a certificate for x ∈ L i . Thus, V i ( x, c ) = 1 if certificate c verifies x ∈ L i , and V i ( x, c ) = 0 otherwise. Since both L 1 and L 2 are both in NP, we know that V i ( x, c ) terminates in polynomial time O ( | x | d ) for some constant d . To show that L 3 = L 1 ∪ L 2 is also in NP, we will construct a polynomial- time verifier V 3 for L 3 . Since a certificate c for L 3 will have the property that either V 1 ( x, c ) = 1 or V 2 ( x, c ) = 1 , we can easily construct a verifier V 3 ( x, c ) = V 1 ( x, c ) ∨ V 2 ( x, c ) . Clearly then x ∈ L 3 if and only if there is a certificate c such that V 3 ( x, c ) = 1 . Notice also that the new verifier V 3 will run in time...
View Full Document
This note was uploaded on 01/22/2011 for the course CIS 341 taught by Professor Nakayama during the Fall '10 term at NJIT.
- Fall '10