combinat::permutationsNK – Low level combinatorial class for permutations of k elements out of n

combinat::permutationsNK is a low level combinatorial class for permutations of k elements out of n.

→ Examples

Categories

Cat::CombinatorialClass, Cat::FacadeDomain(DOM_LIST)

See Also:

combinat::permutations

Details:

count – number of permutations

combinat::permutationsNK::count(nonnegative integer math, nonnegative integer math)

Returns the number of permutations of k elements out of n, that is math.

generator – generator for permutations

combinat::permutationsNK::generator(nonnegative integer math, nonnegative integer math)

Returns a generator for the permutations of k elements out of n, in lexicographic order.

Complexity: Constant Amortized Time (proportional to the number of entries modified, optimal). Memory complexity: math.

list – list of the permutations

combinat::permutationsNK::list(nonnegative integer math, nonnegative integer math)

Returns the list of the permutations of k elements out of n, in lexicographic order.

Complexity in time and memory: proportional to the size of the output: math (optimal).

random – random permutation

combinat::permutationsNK::random(nonnegative integer math, nonnegative integer math)

Returns a random permutation of k elements out of n.

Complexity in time and memory: math (Floyd's algorithm).

Example 1:

Here is the list of all the permutations of 3 elements out of [1,2,3,4]:

    combinat::permutationsNK(4,3)

math

Changes in MuPAD 4.0

New Function.