Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Steinhaus - Johnson - Trotter Algorithm for Permutations (explain)

by barrachois (Pilgrim)
on Jan 04, 2005 at 18:55 UTC ( #419372=note: print w/ replies, xml ) Need Help??


in reply to Re: Steinhaus - Johnson - Trotter Algorithm for Permutations (explain)
in thread Steinhaus - Johnson - Trotter Algorithm for Permutations

A nice explanation of the algorithm; thanks. However, this part isn't quite right.

> # @p is the position of each element in @o, > # that is, @o = (0..$#e)[@p] > my @p= (0..$#e); > # Note that it is also true that @p = (0..$#e)[@o].
In the language of group theory, (0..$#e) is the identity, while @o, @p are inverses of each other. Thus @p[@o]=@o[@p]=(0..$#e). For example,
# an arbitrary permutation @o = @permutation = (1,2,0); # position of 0 is in $o[2], so $p[0]=2. # This leads to @p = @positions = (2,0,1); # And then print " o[p] = (@o[@p]) = p[o] = (@p[@o]) \n";
which outputs
o[p] = (0 1 2) = p[o] = (0 1 2)
Regards,

 barrachois


Comment on Re^2: Steinhaus - Johnson - Trotter Algorithm for Permutations (explain)
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (10)
As of 2014-11-29 01:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (201 votes), past polls