The pairwise sorting network is a sorting network discovered and published by Ian Parberry in 1992 in Parallel Processing Letters.[1] The pairwise sorting network has the same cost (number of comparators) and delay as the odd-even mergesort network.
![]()
Visualization of the Pairwise sorting network with 16 inputs
| |
Class | Sorting algorithm |
---|---|
Data structure | Array |
Worst-case performance | (logn)(logn+1)/2{\displaystyle (\log n)(\log n+1)/2} |
Worst-case space complexity | n(logn)(logn−1)/4+n−1{\displaystyle n(\log n)(\log n-1)/4+n-1} |
以上来自维基百科。
个人理解:
一、分组:
按照奇数偶数分组,长度减半。
两个sub-组 继续按奇数偶数分组,until 子组长度为1.
二、组合:
将分组排序,组合。