Adjacent transposition Created 2026-10-20 Updated 2026-11-05
An adjacent transposition exchanges consecutive positions and in a permutation, leaving the others fixed; as a permutation of positions it is . Every permutation can be sorted using adjacent transpositions. Swapping an out-of-order adjacent pair decreases its inversion number by one because its comparisons with every third entry have the same total before and after the swap. Consequently the minimum number of adjacent transpositions needed to sort a permutation is its inversion number. For 312, the route 312, 132, 123 uses two swaps.
Inversion number Created 2026-10-20 Updated 2026-11-05
The inversion number of a permutation is
For 3142, the inverted pairs of values are , giving three. The inversion number ranges from zero for increasing order to for decreasing order; it is the minimum number of adjacent transpositions needed to sort the permutation. Its parity gives the sign of a permutation, . The same pair-counting formula defines the word inversion number when repeated symbols are allowed.
Major index 2026-11-05
The major index of a permutation is the sum of its permutation descent positions:
It uses positions, rather than the values being compared. For , the permutation descents occur at positions one and three, giving , whereas the descent number is two.
The major index has the same distribution over all permutations of elements as the inversion number:
For , the six values give . Individual statistics need not agree: has major index one and two inversions. The shared generating polynomial is a statement about their distribution across the whole symmetric group.[ref]