Following questions have asked in GATE CS 2006 exam.
1. Let S be an NP-complete problem and Q and R be two other problems not known to be in NP. Q is polynomial time reducible to S and S is polynomial-time reducible to R. Which one of the following statements is true?
(A) R is NP-complete
(B) R is NP-hard
(C) Q is NP-complete
(D) Q is NP-hard
(A) Incorrect because R is not in NP. A NP Complete problem has to be in both NP and NP-hard.
(B) Correct because a NP Complete problem S is polynomial time educable to R.
(C) Incorrect because Q is not in NP.
(D) Incorrect because there is no NP-complete problem that is polynomial time Turing-reducible to Q.
The set Z computed by the algorithm is:
(A) (X Intersection Y)
(B) (X Union Y)
(C) (X-Y) Intersection (Y-X)
(D) (X-Y) Union (Y-X)
The expression x[i] ^ ~y[i]) results the only 1s in x where corresponding entry in y is 0. An array with these set bits represents set X – Y
The expression ~x[i] ^ y[i]) results the only 1s in y where corresponding entry in x is 0. An array with these set bits represents set Y – X.
The operator “V” results in Union of the above two sets.
Let n = 2^m T(2^m) = T(2^(m/2)) + 1 Let T(2^m) = S(m) S(m) = 2S(m/2) + 1
Above expression is a binary tree traversal recursion whose time complexity is Θ(m). You can also prove using Master theorem.
S(m) = Θ(m) = Θ(logn) /* Since n = 2^m */
Now, let us go back to the original recursive function T(n)
T(n) = T(2^m) = S(m) = Θ(Logn)
Please note that the solution of T(n) = T(√n) + 1 is Θ(Log Log n), above recurrence is different, it is T(n) = 2T(√n) + 1
Please write comments if you find any of the answers/explanations incorrect, or you want to share more information about the topics discussed above.