Wiki

Clone wiki

dart_trotter / subsets

Home | Permutations | Combinations | Amalgams | Compositions | Subsets | Compounds | Inverses | About

Subsets

The Subsets (combinations of unspecified length) constructor accepts one argument: a list containing the items in the set to be subsetted.

For example, the following line creates a pseudo-list containing all the subsets of the strings "a" to "e".

var ss = new Subsets(characters("abcde"));

To see how many subsets are "contained" in ss, we can check ss.length. We can retrieve the individual subsets by index, e.g., ss[0].

How are Subsets arranged?

In this library, Subsets are arrangements according to the order in which items appear in the list used during the construction, starting with the empty set. For example, consider the following set of trotters:

There are 32 possible subsets of this set. They are arranged by the algorithm as follows:

(dot, dot, dot)

Updated