I´ve read at wiki http://en.wikipedia.org/wiki/Subset_sum_problem#Pseudo-polynomial_time_dynamic_programming_solution about the sumsubsetproblem and wonder if i can adapt it to the following problem:
I need all possible subsets ss1, ss2 restricted by n1, n2 being the number of elements out of 2 sets s1,s2
I will use the elements of S1 as positive elements and the elements of s2 as negative elements to answer the question if the subsets of size n1 and n2 have sum equal 0
My special problem here is that the sets can contain 0 itselfs and i thought i solve this by setting these elements to 1 or -1 repectivly ( 1 is not a member of my input, which will be (0,10,50,100,200,500) ) and the next problem is that this algorithm gives me yes or no only, but i know this answer already ( its a precondition ) what i need is the results.
Is this still fast enough ? i ´ve read here about an perl implementation where the OP posted a list with runtimes an 30 elements had a computation time of 30-40 seconds wich is far too slow for my needs and i need to implement in java, wich is, as far as i know even slower then perl
regards
dirk