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.
Categories
Cat::CombinatorialClass, Cat::FacadeDomain(DOM_LIST)
See Also:
Details:
A permutation of k elements out of n is a list of k distinct elements of [1,...,n], in any order. Such permutations are also sometimes called arrangements in the litterature.
This is a low-level combinatorial class, with a simplistic interface by design.
count – number of permutations
combinat::permutationsNK::count(nonnegative integer , nonnegative integer )
Returns the number of permutations of k elements out of n, that is .
generator – generator for permutations
combinat::permutationsNK::generator(nonnegative integer , nonnegative integer )
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: .
list – list of the permutations
combinat::permutationsNK::list(nonnegative integer , nonnegative integer )
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: (optimal).
random – random permutation
combinat::permutationsNK::random(nonnegative integer , nonnegative integer )
Returns a random permutation of k elements out of n.
Complexity in time and memory: (Floyd's algorithm).
Here is the list of all the permutations of 3 elements out of [1,2,3,4]:
combinat::permutationsNK(4,3)
Changes in MuPAD 4.0
New Function.