Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: permutation understanding

by Parham (Friar)
on May 27, 2002 at 20:55 UTC ( #169644=note: print w/replies, xml ) Need Help??

in reply to permutation understanding

i actually thought i'd do a followup on this post, cuz i got a little better understanding of how it works.

Take the inputted number, now move the first number to the beginning of a new list. Take the old and new lists and permute those. Take the first number of the old list and take it to the new list. Permute the two lists. Take the first number of the old list and move it to the new list.

Each time, check to see if the old list is completely empty, if it is, start moving backwards in foreach loops. Go back one foreach loop, move the second number to the new list, and permute those two lists. It's weird to explain, so i'd rather show you what i came up with hoping that this will help those who didn't understand how the permutation worked.

The follwing two URL's show how the permutation works. The first link is a simple explanation of a list of three elements (x, y, and z) while the second takes a deeper look at a list with four elements (1, 2, 3, and 4)

simple interpretation
actual example using four elements

i hope these help people who don't quite know how the function works :).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://169644]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2018-05-20 16:48 GMT
Find Nodes?
    Voting Booth?