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. Articles by others on the same topic
There are currently no matching articles.