wrote:
> On Dec 21, 9:16 am, Patrick <natbro...@gmail.com> wrote:
>> Hi,
>> I want to write a programs that checks if a set of numbers in a list
>> obey a condition, the problem is that i have say "n" numbers and i
>> need to check all subsets of the n numbers for the condition.
>> How do i go about asking c++ to find the subsets and then check??
>>
>> Thanks:
>> Patrick
>
> The algorithm you use will depend on what condition must be obeyed.
> For example, if the condition is that the subset must not contain any
> odd numbers, it is pretty easy. However, if the condition is that the
> subset must contain as many of the original numbers as possible but no
> three are allowed to sum up to 172, then it is a lot trickier.
I prefer to check for membership in the set of all sets that do not
contain themselves