Combinatorics - How to combine elements of sets

DimDim

Newcomer
Joined
Jun 27, 2003
Messages
1
Lets say we have N set of M elements (not every set has the same number of elements).

The problem is that the number of sets (N) isn't known.

Those sets are created from the program and they could be hundreds of them. I don't know from the beginning how many are they. The number of set becomes known from the execution of the program.

How can we program to have all possible combinations between the elements, if we choose only one element from each set.

How can I make an interior loop to do that?

Can I do that in a database?

e.g.

{1,2}, {1,3,4}, {5,6}

1-1-5
1-1-6
1-3-5
1-3-6
1-4-5
1-4-6
2-1-5
2-1-6
2-3-5
2-3-6
2-4-5
2-4-6
 
100 Sets with 10 elements in each will give you
10 ^ 100 possible permutations.

You should consider restricting the number of possible sets, I think :-)
 
Back
Top