Complexity kills. It sucks the life out of developers, it makes products difficult to plan, build and test, it introduces security challenges, and it causes end-user and administrator frustration. Ray Ozzie

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.