Wiki
Clone wikidart_trotter / permutations
Home | Permutations | Combinations | Amalgams | Compositions | Subsets | Compounds | Inverses | About
Permutations
The Permutations
constructor accepts two arguments: the number of items to take from a set and a list containing the items in the set.
For example, the following line creates a pseudo-list containing all the 3-permutations of the strings "a"
to "e"
.
var p = new Permutations(3, characters("abcde"));
To see how many permutations are "contained" in p
, we can check p.length
. We can retrieve the individual permutations by index, e.g., p[0]
.
How are Permutations
arranged?
In this library, Permutations
are arrangements of items taken from a set for which:
- Order is important.
- Items are not replaced.
For example, consider the following set of trotters:
There are 60 3-permutations of trotters taken from this set. They are arranged by the algorithm (see Johnson-Steinhaus-Trotter) as follows:
(dot, dot, dot)
Updated