Abstract
Until recently, it was not known whether it was possible to sortstably (i.e., keeping equal elements in their initial order) an array ofn elements using onlyO(n) data moves andO(1) extra space. In [13] an algorithm was given to perform this task inO(n 2) comparisons in the worst case. Here, we develop a new algorithm for the problem that performs onlyO(n 1+ε) comparisons (0<ε<1 is any fixed constant) in the worst case. This bound on the number of comparisons matches (asymptotically) the best known bound for the same problem with the stability constraint dropped.
Similar content being viewed by others
References
E. H. Friend, Sorting on Electronic Computers,Journal of the ACM,3(2) (1956), 134–168.
B. C. Huang and M. A. Langsten, Practical In-place Merging,Communications of the ACM,31(3) (1988), 348–352.
B. C. Huang and M. A. Langston, Fast Stable Merging and Sorting in Constant Extra Space,Proceedings of the International Conference on Computing and Information, 1989, pp. 71–80.
J. Katajainen and T. Pasanen, Sorting Multisets Stably in Minimum Space,Proceedings of the 3rd Scandinavian Workshop on Algorithm Theory, Lecture Notes in Computer Science, Vol. 621, Springer-Verlag, Berlin, 1992, pp. 410–421.
D. E. Knuth,The Art of Computer Programming, Vol. III, Addison-Wesley, Reading, MA, 1973.
M. A. Kronrod, Optimal Ordering Algorithm Without Operational Field,Soviet Math. Dokl.,10 (1969), 744–746.
T. W. Lai and D. Wood, Implicit Selection,Proceedings of the 1st Scandinavian Workshop on Algorithm Theory, Lecture Notes in Computer Science, Vol. 318, Springer-Verlag, Berlin, 1988, pp. 14–23.
J. I. Munro, An Implicit Data Structure Supporting Insertion, Deletion, and Search inO(lg2 n) Time,Journal of Computer and System Sciences,21 (1980), 236–250.
J. I. Munro and V. Raman, Fast Stable In-Place Sorting withO(n) Data Moves,Proceedings ofthe 11th FST & TCS Conference, New Delhi, Lecture Notes in Computer Science, Vol. 560, Springer-Verlag, Berlin, 1991, pp. 266–277.
J. I. Munro and V. Raman, Sorting Multisets and Vectors In-Place,Proceedings of the 2nd Workshop on Algorithms and Data Structures, Lecture Notes in Computer Science, Vol. 519, Springer-Verlag, Berlin, 1991, pp. 473–480.
J. I. Munro and V. Raman, Sorting with Minimum Data Movement,Journal of Algorithms,13 (1992), 374–393.
J. I. Munro and V. Raman, Selection from Read-Only Memory and Sorting with Optimum Data Movement,Proceedings of the 12th FST & TCS Conference, New Delhi, Lecture Notes in Computer Science, Vol. 652, Springer-Verlag, Berlin, 1992, pp. 380–391; to appear inTheoretical Computer Science.
J. I. Munro, V. Raman, and J. S. Salowe, Stable In Situ Sorting and Minimum Data Movement,BIT,30 (1990), 220–234.
V. Raman, Sorting In-Place with Minimum Data Movement, Ph.D. Thesis, Technical Report CS 91-12, Department of Computer Science, University of Waterloo (1991).
L. Trabb Pardo, Stable Sorting and Merging with Optimal Space and Time Bounds,SIAM Journal of Computing,6 (1977), 351–372.
J. W. J. Williams, Algorithm 232, Heapsort,Communications of the ACM,7 (1964), 347–348.
Author information
Authors and Affiliations
Additional information
Communicated by R. Sedgewick.
A version of this paper appeared in theProceedings-of the 11th FST & TCS Conference [9]. This research was supported by NSERC of Canada grant No. A-8237 and the ITRC of Ontario.
Rights and permissions
About this article
Cite this article
Munro, J.I., Raman, V. Fast stable in-place sorting withO(n) data moves. Algorithmica 16, 151–160 (1996). https://doi.org/10.1007/BF01940644
Received:
Revised:
Issue Date:
DOI: https://doi.org/10.1007/BF01940644