HOME

TheInfoList



OR:

The pairwise sorting network is a
sorting network In computer science, comparator networks are abstract devices built up of a fixed number of "wires", carrying values, and comparator modules that connect pairs of wires, swapping the values on the wires if they are not in a desired order. Such net ...
discovered and published by Ian Parberry in 1992 in ''
Parallel Processing Letters ''Parallel Processing Letters'' is a journal published by World Scientific since 1991. It covers the field of parallel processing, including topics such as design and analysis of parallel and distributed algorithms, parallel programming languages a ...
''. 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(log^2 n). It requires n(\log n)(\log n - 1)/4 + n - 1 comparators and has depth (\log n)(\log n + 1)/2. The sorting procedure implemented by the network is as follows (guided by the zero-one principle): # Sort consecutive pairwise bits of the input (corresponds to the first layer of the diagram) # Sort all pairs into lexicographic order by recursively sorting all odd bits and even bits separately (corresponds to the next 14 layers of the diagram) # Sort the pairs in nondecreasing order using a specialized network (corresponds to the final layers of the diagram)


Relation to Batcher odd-even mergesort

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.


References


External links


Sorting Networks
– Archive of web page by the author. Sorting algorithms {{algorithm-stub