Abstract
We considered the following natural conjecture: For every sorting algorithm every key will be involved inΩ(logn) comparisons for some input. We show that this is true for most of the keys and prove matching upper and lower bounds. Every sorting algorithm for some input will involven−n ε/2+1 keys in at leastεlog2 n comparisons,ε>0. Further, there exists a sorting algorithm that will for every input involve at mostn−n ε/c keys in greater thanεlog2 n comparisons, wherec is a constant andε>0. The conjecture is shown to hold for “natural” algorithms from the literature.
Similar content being viewed by others
References
M. Ajtai, J. Komlos, and E. Szemeredi,An O(n log n) sorting network, Proc. 15th ACM Symp. Theory of Computation, 1983, pp. 1–9.
M. Atallah and S. Kosaraju,An adversary-based lower bound for sorting, Info. Proc. Let., 13, 1981, pp. 55–57.
A. Borodin, L. J. Guibas, N. A. Lynch, and A. C. Yao,Efficient searching using partial ordering, Info. Proc. Let., 12, 1981, pp. 71–75.
F. Fussenegger and H. Gabow,A counting approach to lower bounds for selection problems, J. ACM, 26, 1979, pp. 227–238.
J. R. Griggs,Poset measure and saturated partitions, Studies in Applied Math., 66, 1982, pp. 91–93.
D. E. Knuth,The Art of Computer Programming: Fundamental Algorithms, Addison-Wesley, 1968.
D. E. Knuth,The Art of Computer Programming: Sorting and Searching, Addison-Wesley, 1973.
D. S. Richards,Problems in Sorting and Graph Algorithms, UIUCDCS-R-84-1186, Ph.D. Thesis, University of Illinois, 1984.
D. S. Richards,Sorting with expensive comparands, International Journal of Computer Mathematics, 16, 1984, pp. 23–45.
M. Saks,The information theoretic bound for problems on ordered sets and graphs, inGraphs and Orders, I. Rival (ed.), Reidel, 1985, 137–168.
H. Wilf,Some examples of combinatorial averaging, Am. Math. Monthly, 92, 1985, pp. 250–261.
Author information
Authors and Affiliations
Rights and permissions
About this article
Cite this article
Richards, D., Vaidya, P. On the distribution of comparisons in sorting algorithms. BIT 28, 764–774 (1988). https://doi.org/10.1007/BF01954896
Received:
Revised:
Issue Date:
DOI: https://doi.org/10.1007/BF01954896