Class: | Sorting algorithm |
Data: | Array |
Time: | (logn)(logn+1)/2 |
Space: | n(logn)(logn-1)/4+n-1 |
Optimal: | No |
The pairwise sorting network is a sorting network discovered and published by Ian Parberry in 1992 in Parallel Processing Letters. The pairwise sorting network has the same size (number of comparators) and depth as the odd–even mergesort network. At the time of publication, the network was one of several known networks with a depth of
O(log2n)
n(logn)(logn-1)/4+n-1
(logn)(logn+1)/2
The sorting procedure implemented by the network is as follows (guided by the zero-one principle):
The pairwise sorting network is very similar to the Batcher odd-even mergesort, but differs in the structure of operations. While Batcher repeatedly divides, sorts and merges increasingly longer subsequences, the pairwise method does all the subdivision first, then does all the merging at the end in the reverse sequence. In certain applications like encoding cardinality constraints, the pairwise sorting network is superior to the Batcher network.[1]