The subset-sum problem is defined as follows: Given a set of positive integers and a positive integer , determine whether there is a subset of whose elements sum to . An algorithm solves this problem in time. Which of the following statements is false?
View worked solution
Answer: B
The subset-sum problem is a well-known NP-complete problem, which means it is both in and is . Thus, statements C and D are true.
The algorithm runs in time. Let us analyze the complexity based on the input encoding:
- Unary Encoding: The number is represented by a sequence of ones, so the input size is proportional to . The running time is polynomial with respect to the input size . Thus, statement A is true.
- Binary Encoding: The number is represented using bits. The input size is proportional to . Expressing the running time in terms of the input size gives , which is exponential in terms of the binary input size. Thus, is a pseudo-polynomial time algorithm and does not run in polynomial time for binary encoding. Statement B is false.
Free practice · Your answers on this page are not saved.
