Re: How to construct all possible orderings

• To: mathgroup at smc.vnet.net
• Subject: [mg15636] Re: [mg15588] How to construct all possible orderings
• From: "Richard Finley" <rfinley at medicine.umsmed.edu>
• Date: Sat, 30 Jan 1999 04:28:35 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

Hello Carlos,

There may be a specific function to do this but I am not aware of it.
Here is a rather contrived but efficient way to accomplish what you
wish:

Table[{i,j,k}, {i,1,3},{j,1,3},{k,1,3}] /. {1->A, 2->B, 3->C} //
TableForm

That will give you all 27 of your possibilities in a nice table....it
would of course be easy to write your own function to do this for any n
elements, but looking at them would get rather tedious as n gets larger
(n^n)

regards,   RF

>>> "Carlos Carreto" <ccarreto at ipg.pt> 01/28/99 03:23AM >>>
Hello,

I am trying to construct all possible orderings  of  for example 3
elements, where each element can be A, B or C.

The result will be something like this: AAA AAB
AAC
ABA
. . .
CCC

How can I do this?

Thank you.

-:- Carlos

• Prev by Date: Re: Dividing top and bottom
• Next by Date: Re: speed
• Previous by thread: Re: How to construct all possible orderings
• Next by thread: Re: How to construct all possible orderings