TOPICS
Search

Permutation Inversion


A pair of elements (p_i,p_j) is called an inversion in a permutation p if i>j and p_i<p_j (Skiena 1990, p. 27; Pemmaraju and Skiena 2003, p. 69). For example, in the permutation a_6a_5a_7a_3a_8 contains the four inversions a_7a_3, a_5a_3, a_6a_3, and a_6a_5. Inversions are pairs which are out of order, and are important in sorting algorithms (Skiena 1990, p. 27).

The total number of inversions can be obtained by summing the elements of the inversion vector. The number of inversions in any permutation is the same as the number of interchanges of consecutive elements necessary to arrange them in their natural order (Muir 1960, p. 1). The value (-1)^(i(p)) can be found in the Wolfram Language using Signature[p].

The number of inversions in a permutation is equal to that of its inverse permutation (Skiena 1990, p. 29; Knuth 1998). If, from any permutation, another is formed by interchanging two elements, then the difference between the number of inversions in the two is always an odd number.


See also

Inverse Permutation, Inversion Vector, Permutation, Permutation Symbol

Explore with Wolfram|Alpha

References

Knuth, D. E. The Art of Computer Programming, Vol. 3: Sorting and Searching, 2nd ed. Reading, MA: Addison-Wesley, 1998.Mannila, H. "Measures of Presortedness and Optimal Sorting Algorithms." IEEE Trans. Comput. 34, 318-325, 1985.Muir, T. A Treatise on the Theory of Determinants. New York: Dover, 1960.Pemmaraju, S. and Skiena, S. Computational Discrete Mathematics: Combinatorics and Graph Theory in Mathematica. Cambridge, England: Cambridge University Press, 2003.Skiena, S. "Encroaching Lists as a Measure of Presortedness." BIT 28, 775-784, 1988.Skiena, S. "Inversions and Inversion Vectors." §1.3 in Implementing Discrete Mathematics: Combinatorics and Graph Theory with Mathematica. Reading, MA: Addison-Wesley, pp. 27-31, 1990.

Referenced on Wolfram|Alpha

Permutation Inversion

Cite this as:

Weisstein, Eric W. "Permutation Inversion." From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/PermutationInversion.html

Subject classifications