Abstract
It is well known that n integers in the range [1,n c] can be sorted in O(n) time in the RAM model using radix sorting. More generally, integers in any range [1,U] can be sorted in \(O(n\sqrt{\log\log n})\) time [5]. However, these algorithms use O(n) words of extra memory. Is this necessary?
We present a simple, stable, integer sorting algorithm for words of size O(logn), which works in O(n) time and uses only O(1) words of extra memory on a RAM model. This is the integer sorting case most useful in practice. We extend this result with same bounds to the case when the keys are read-only, which is of theoretical interest. Another interesting question is the case of arbitrary c. Here we present a black-box transformation from any RAM sorting algorithm to a sorting algorithm which uses only O(1) extra space and has the same running time. This settles the complexity of in-place sorting in terms of the complexity of sorting.
A full version of this paper is available as arXiv:0706.4107.
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Andersson, A., Hagerup, T., Nilsson, S., Raman, R.: Sorting in linear time? Journal of Computer and System Sciences 57(1), 74–93 (1998)
Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms. MIT Press, Cambridge (2001)
Fredman, M.L., Willard, D.E.: Surpassing the information theoretic bound with fusion trees. J. Comput. System Sci. 47, 424–436 (1993)
Fredman, M.L., Willard, D.E.: Trans-dichotomous algorithms for minimum spanning trees and shortest paths. J. Comput. System Sci. 48(3), 533–551 (1994)
Han, Y., Thorup, M.: Integer sorting in \(O(n \sqrt{\log \log n})\) expected time and linear space. In: FOCS, pp. 135–144. IEEE Computer Society, Los Alamitos (2002)
Katajainen, J., Pasanen, T.: Stable minimum space partitioning in linear time. BIT 32(4), 580–585 (1992)
Katajainen, J., Pasanen, T.: Sorting multisets stably in minimum space. Acta Informatica 31(4), 301–313 (1994)
Kronrod, M.A.: Optimal ordering algorithm without operational field. Soviet Math. Dokl. 10, 744–746 (1969)
Munro, J.I.: An implicit data structure supporting insertion, deletion, and search in O(log2 n) time. Journal of Computer and System Sciences 33(1), 66–74 (1986)
Salowe, J., Steiger, W.: Simplified stable merging tasks. Journal of Algorithms 8(4), 557–571 (1987)
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 2007 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Franceschini, G., Muthukrishnan, S., Pǎtraşcu, M. (2007). Radix Sorting with No Extra Space. In: Arge, L., Hoffmann, M., Welzl, E. (eds) Algorithms – ESA 2007. ESA 2007. Lecture Notes in Computer Science, vol 4698. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-75520-3_19
Download citation
DOI: https://doi.org/10.1007/978-3-540-75520-3_19
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-75519-7
Online ISBN: 978-3-540-75520-3
eBook Packages: Computer ScienceComputer Science (R0)