Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. Brian Kernighan

Subset Sum Problem

Language Java | Level Intermediate | Category Algorithms | August 4, 2015 9:17 am


Algorithm Problem Description

Given a set of integers, is there a non-empty subset whose sum is zero? For example, given the set {?7, ?3, ?2, 5, 8}, the answer is yes because the subset {?3, ?2, 5} sums to zero

Output

          	        
          	        

Size of input set: 4
Target value: 4
  Input   Dynamic Table
----------------------
  0 	   0
  1 	   1
  2 	   2
  3 	   2
  4 	   3

Solution
 Input  solution
----------------------
  3 	   3
  1 	   1

          	        
          	        				    


Comments



Please login to add comments.