Generating subets of limited cardinality and presence of an element required...

Hi,

I have a set of 100 integers. For each one of these integers there is a subset Ni that contains each i and 9 others integers. I need to generate all subsets of Ni that also contains i, the other ones does not interest me.

A example.

N7 = {1,4,7,19,28,45,52,66,72,95}, i = 7

subset of N7 with cardinality equal 1: {7}
subset of N7 with cardinality equal 2: {1,7}; {4,7}; {7,19}; {7,28}; {7,45}; {7,52}; {7,66}; {7,72}; {7,95}
subset of N7 with cardinality equal 3: {1,4,7}; {1,7,19}; {1,7,28} ... {7,66,72}; {7,66,95}; {7,72,95}

...
subset of N7 with cardinality equal 10: N7 = {1,4,7,19,28,45,52,66,72,95}
Last edited on
If you end generating all subsets, then the limited cardinality is not an issue. Just generate them all and then distribute them according to their size.


For the presence of an element, remove the element from the set, then generate all the subsets without any restriction, and just insert the element in every subset.
So I would have 2100 subsets possibles (and this is a number not possible to process). Then, I'm not able to generate all these subsets. An author who implemented this subset told me to use bitmask, but I have no idea in how to do this.
> Ni that contains each i and 9 others integers
so 29 subsets
Topic archived. No new replies allowed.