Wiki
Clone wikidart_trotter / combinations
Home | Permutations | Combinations | Amalgams | Compositions | Subsets | Compounds | Inverses | About
Combinations
The Combinations
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-combinations of the strings "a"
to "e"
.
var c = new Combinations(3, characters("abcde"));
To see how many combinations are "contained" in c
, we can check c.length
. We can retrieve the individual combinations by index, e.g., c[0]
.
How are Combinations
arranged?
In this library, Combinations
are arrangements of items taken from a set for which:
- Order is not important.
- Items are not replaced.
For example, consider the following set of trotters:
There are 10 3-combinations of trotters taken from this set. They are arranged by the algorithm as follows:
Updated