Batcher's Algorithm

M. Goemans
Abstract:Perhaps the most restrictive version of the sorting problem requires not only no motion of the keys beyond compare-and-switches, but also that the plan of comparison-and-switches be fixed in advance. In each of the methods mentioned so far, the comparison to be made at any time often depends upon the result of previous comparisons. For example, in HeapSort, it appears at first glance that we are making only compare-and-switches between pairs of keys, but the comparisons we perform are not fixed in advance. Indeed when fixing a headless heap, we move either to the left child or to the right child depending on which child had the largest element; this is not fixed in advance. A sorting network is a fixed collection of comparison-switches, so that all comparisons and switches are between keys at locations that have been specified from the beginning. These comparisons are not dependent on what has happened before. The corresponding sorting algorithm is said to be non-adaptive. We will describe a simple recursive non-adaptive sorting procedure, named Batcher's Algorithm after its discoverer. It is simple and elegant but has the disadvantage that it requires on the order of n(log n) 2 comparisons. which is larger by a factor of the order of log n than the theoretical lower bound for comparison sorting. For a long time (ten years is a long time in this subject!) nobody knew if one could find a sorting network better than this one. Then Ajtai, Komlós, and Szemerédi proved the existence of very complex networks that can sort with cn log n comparisons for a very large constant c. Their procedure is extremely complicated, and for most practical purposes Batcher's algorithm is more useful. The idea behind Batcher's algorithm is the following claim (which at first glance looks incredible): If you sort the first half of a list, and sort the second half separately, and then sort the odd-indexed entries (first, third, fifth, ...) and the even-indexed entries (second, fourth, sixth, ...) separately, then you need make only one more comparison-switch per key to completely sort the list. We will prove this below. For the remainder of this section, we will assume that the length of our list, n, is a power of 2. Let's see what happens for a particular list of length 8. Suppose we are given the following list of numbers: 2 7 6 3 9 4 1 …
What problem does this paper attempt to address?