A Sorting Problem

An important problem in sorting is to arrange item keys in monotonic ascending order within the internal memory of a digital computer. An excellent survey of some known methods of dealing with this problem is presented in [2], and the reader's familiarity with the main concepts of that paper is presupposed. For very large files, say in the range of 10 ~ to 10 5 items, it is worthwhile to consider schemes which require only a minimum of working storage space, that is, only n locations where n is the largest number of item keys which together with the program can be stored in the internal memory. Two available schemes which are workable within n locations, namely exchanging and selection (with exchange), both entail a very large number of comparisons, in fact ~ n ( n 1)/2. Two-way merging [1, 3, 4] which requires only n[log2 n] comparisons where [log2 n] is the next integer greater than log2 n, is vastly more economical in point of operations, but requires 2n locations at least, and thus may be ruled out for large n even on the biggest available computers. Two aims of this paper are (1) to find the least number of comparisons needed for sorting n items within the original locations (within the "source file"), 2 and (2) to provide an algorithm employing the least number of comparisons for obtaining a sorted file. Answers, which we conjecture are complete solutions, to (1) and (2) are given in the following Sections 2-6, and comparisons with other methods are presented in Section 7.