Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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 :).


Comment on Re: permutation understanding

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://169644]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2014-08-28 07:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (257 votes), past polls