1
$\begingroup$

Given, {A,B,C} {D,E} {X,Y,Z}

I want the following result: • {A,D,X} • {A,D,Y} • {A,D,Z} • {A,E,X} • {A,E,Y} • {A,E,Z} • {B,D,X} • {B,D,Y} • {B,D,Z} • {B,E,X} • {B,E,Y} • {B,E,Z} • {C,D,X} • {C,D,Y} • {C,D,Z} • {C,E,X} • {C,E,Y} • {C,E,Z}

Can you please point me to the set operator which does this? I am also trying to find the algorithm for the above, given "n" number of Sets with varying number of values in them.

1 Answers 1

3

You're looking for the Cartesian product of three sets:

$ \{A, B, C\} \times \{D, E\} \times \{X, Y, Z\} $

For a discussion of algorithms, see this question on StackOverflow.

  • 0
    thanks. that exactly what I was looking for.2012-05-28