Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program. Linus Torvalds

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.