Permutation with sets of elements

I want to write a code to find the permutation of these sets:
A {A1, A2}
B {B1, B2}
C {C1, C2}

I want to keep the order of A, B, C, but want to get the permutation of the elements like:
A1, B1, C1
A1, B1, C2
A1, B2, C1
A1, B2, C2
A2, B1, C1
A2, B1, C2
A2, B2, C1
A2, B2, C2

I can't figure out the algorithm to do this! Please help!!
Last edited on
High!

I would begin with this order :
A1, A2, B1, B2, C1, C2, ...
0 1 2 3 4 5, 6...
after that on comparing a range within an order went to an element of the order.
Also should have been aware of the limit that is actually as vast as unseen one.
And repeatedly.
Topic archived. No new replies allowed.