0 0 votes closed as a duplicate of: GATE CSE 2008 | Question: 44 The subset-sum problem is defined as follows: Given a set S of n positive integers and a positive integer W, determine whether there is a subset of S whose elements sum to W. An algorithm Q solves this problem in O(nW) time. Which of the following statements is false? Q solves the subset-sum problem in polynomial time when the input is encoded in unary Q solves the subset-sum problem in polynomial time when the input is encoded in binary The subset sum problem belongs to the class NP The subset sum problem is NP-hard Please explain me how the option 1 is true. Algorithms + – Vipin Rai 1.9k views comment Share Follow Print See all 5 Comments 5 5 Comments reply Show 2 previous comments Vipin Rai commented Nov 8, 2018 reply Follow flag Thank you I checked it but I'm not able to understand how encoding in unary will make it polynomial. If value of W become very high then no bits required will be high What does W depends on? 0 0 replyShare kumar.dilip commented Nov 8, 2018 reply Follow flag If value of W become very high then no bits required will be high If W is very High we have to go for O(2n) 0 0 replyShare kumar.dilip commented Nov 8, 2018 reply Follow flag I checked it but I'm not able to understand how encoding in unary will make it polynomial. Let's take the example What will the 10 in unary(Only 1 bit) Then we have write 10 times 1 1111111111 For 50 we have write 50 time like 1111111..........50 times. Ok So, the length of the input is equal to the value of the input. So, complexity = O(nW) where both n and W are linear multiples of the length of the inputs. So, the complexity is polynomial in terms of the input length. So, (A) is true. 1 1 replyShare Please log in or register to add a comment.