Re: Subsets from a set
- From: stush@xxxxxxxxxxxxxx
- Date: 4 Aug 2006 09:41:06 -0700
stdazi@xxxxxxxxx wrote:
What i'd like to get is something like this
set A = {2,3,4,5}
subsets(A, 2) returns :
{2,3}, {2,4}, {2,5}, {3,5}, {4,5} .....
for subsets(A,n) you just need an array of size n. call it p. then a
subset S is
for(i=0;i<n;i++)
{
S[i] = A[p[i]];
}
to iterate over p, just notice that p[0] < p[1] < p[2] < ... < p[n-1]
with each p[i] between 0 and the size of A less 1.
.
- References:
- Subsets from a set
- From: stdazi@xxxxxxxxx
- Re: Subsets from a set
- From: stush
- Re: Subsets from a set
- From: stdazi@xxxxxxxxx
- Subsets from a set
- Prev by Date: Re: Definition of Empty Graph
- Next by Date: Re: Definition of Empty Graph
- Previous by thread: Re: Subsets from a set
- Next by thread: Re: Subsets from a set
- Index(es):