GATE / CS ARCHIVE

GATE CSE 2008 / QUESTION 44

Pseudo-polynomial subset-sum complexity

Algorithms · Computational Complexity · Full GATE CSE 2008 paper

GATE 2008, Q44 2 marks · MCQ
Not in GATE 2027 syllabusReport issue

Computational Complexity

Question 44, GATE 2008: Subset sum asks whether a subset of n positive integers sums to a positive integer W. Algorithm Q takes O(nW) time. Which statement is false?

(A) Q is polynomial-time for unary input encoding
(B) Q is polynomial-time for binary input encoding
(C) Subset sum belongs to NP
(D) Subset sum is NP-hard
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. B is false. The dynamic program takes O(nW), polynomial in the numerical value W, not in its binary encoding length Θ(log W).
2. For binary input W can be exponential in the input length, so this is a pseudo-polynomial algorithm. With unary encoding the input has length at least W and at least n, hence nW is polynomial in that length.
3. A subset is a polynomial-size certificate whose sum can be checked in polynomial time, so subset sum is in NP; its standard decision form is NP-complete and therefore NP-hard. Thus A, C and D are true.

Original paper, page 8