Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Algorithm for deriving permutations
Replies: 26   Last Post: Oct 21, 2007 2:16 PM

 Messages: [ Previous | Next ]
 rossum Posts: 731 Registered: 12/13/04
Re: Algorithm for deriving permutations
Posted: Oct 19, 2007 7:16 AM

On Thu, 18 Oct 2007 08:05:42 -0700, Water Cooler v2
<wtr_clr@yahoo.com> wrote:

>If you have, say, 4 boxes to put the following 6 types of things in:
>
>Apples
>Oranges
>Pears
>Bananas
>Gooseberry
>Lemon
>
>
>Such that you could:
>
>a) only put one piece of each of the things in one box; and
>
>b) you could put the same thing in all the boxes, i.e you could put,
>say, an apple each in each of the boxes. In the mathematical jargon,
>if repetition was allowed
>
>
>Then, I know that we could have 6*6*6*6, i.e 1296 permutations.
>
>However, I want to know the algorithm to decide what those
>combinations are. Help appreciated.

Given the information on the actual size of your problem, an
alternative approach would be to look at a "next permutation"
function, as in C++. Rather than generating all the permutations in
one go, just deal with them one at a time and step to the next one as
required.

rossum

Date Subject Author
10/18/07 Water Cooler v2
10/18/07 Randy Poe
10/18/07 Water Cooler v2
10/18/07 hardwidg
10/18/07 Richard Heathfield
10/18/07 Proginoskes
10/18/07 Robert Israel
10/18/07 Proginoskes
10/19/07 David Bernier
10/19/07 Richard Heathfield
10/18/07 Randy Poe
10/19/07 David Breton
10/19/07 Proginoskes
10/19/07 Richard Harter
10/19/07 Marshall
10/19/07 Patricia Shanahan
10/18/07 briggs@encompasserve.org
10/18/07 Patrick Hamlyn
10/19/07 mensanator
10/19/07 hagman
10/19/07 Patrick Hamlyn
10/19/07 Richard Heathfield
10/19/07 mensanator
10/19/07 rossum
10/20/07 Grouchy