Maths › Combinatorics ›
Permutations
Check
Checks whether an array represents a permutation.
bool | check (int n, int *p) |
Ascending Subsequence
Finds the longest ascending subsequence of a permutation.
std::vector<int> | ascending_subsequence (int n, int *a) |
Breaks
Counts the number of breaks in a permutation.
int | break_count (int n, int *p) |
Cycles
Counts the number of cycles in a permutation.
int | cycles (int n, int *p) |
Derangement Check
Verifies if a given permutation is a derangement.
bool | derangement_check (int n, int *a)[inline] |
Inverse
Calculates the inverse of the given permutation.
std::vector<int> | inverse (int n, int *p) |
Inverse Large
Calculates the inverse of the given permutation.
std::vector<int> | inverse_large (int n, int *p) |
Inversion Sequence
Computes the inversion sequence of a permutation.
std::vector<int> | inversion_sequence (int n, int *p) |
Multiplication
Computes the product of two permutations.
std::vector<int> | multiplication (int n, int *p1, int *p2) |
Partition
Computes the partition generated by the given permutation.
std::vector<int> | partition (int n, int *p) |
Rank
Computes the rank of the given permutation, as generated by Permutation Class 2.
int | rank (int n, int *p) |
Sign
Calculates the sign of the given permutation.
int | sign (int n, int *p) |
Ulam Distance
Computes the Ulam metric distance of two permutations.
int | ulam_distance (int n, int *a, int *b)[inline] |
Unrank
Returns the permutation of the given rank, as generated by the Permutation Class 2 component.
std::vector<int> unrank | unknown (int n, int rank) |
Unused Items
Reports the unused items in a partial permutation.
std::vector<int> unused_items | unknown (int n, int npart, int *part) |
Permutation1
Progressively generates all the permutations of the given size.
Permutation2
Progressively generates all the permutations of the given size.
Permutation3
Progressively generates all the permutations of the given size.
Permutation Lex
Progressively generates all the permutations of the given size, in lexicographic order.