inversions {Tex4exams} | R Documentation |
Count the number of total inversions of a permutation
Description
inversions() counts the number of inversions of a permutation.
Usage
inversions(x)
Arguments
x |
a permutation of 1, 2, ..., n. |
Details
Input must be a list of numbers.
Value
The total number of inversions in a list.
See Also
Examples
inversions(c(3,1,2))
[Package Tex4exams version 0.1.2 Index]