Re: counting subsets of S so that sum(S_n) = N




Logan Shaw je napisal:
azi.stdout@xxxxxxxxx wrote:
Well, it's not really the NP completeness that bothers me, but rather
my lame "subset" generation method.. Many "subsets" repeat over time
so I have to keep track of already summed sets and check them each
time I've encountered a "valid" subset.

I'm wondering.. Is there really no elegant way to get rid of repeated
subsets, and make my algorithm generate only unique subsets?

I assume you're referring to cases like then one where S is (2, 3, 2, 5)

S is a "proper" set, that is, it contains only unique elements. S_n,
the set with the sum propriety is the one that can hold repeated
values.

.