Abstract
We provide tight upper and lower bounds, up to a constant factor, for the number of accesses (I/Os) to secondary storage required for four sorting-related problems: sorting, the fast Fourier transform (FFT), permutation networks, and permuting records. The bounds hold both in the worst case and in the average case. Secondary storage is modeled as a magnetic disk capable of transfering P blocks each containing B records in a single time unit; the records in each block must be input from or output to B contiguous locations on the disk. We give two optimal algorithms for the problems, which are variants of merge sorting and distribution sorting. In particular we show for P=1 that the standard merge sorting algorithm is an optimal external sorting method. Our sorting algorithms use the same number of I/Os as does the permutation phase of key sorting, except when the internal memory size is extremely small, thus substantiating the popular adage that key sorting is not better. We also give a simpler and more direct derivation of a result due to Hong and Kung, which gives the FFT lower bound for the special case B=P=O(1).
Support was provided in part by NSF research grant DCR-84-03613, by an NSF Presidential Young Investigator Award with matching funds from an IBM Faculty Development Award and an AT&T research grant, and by a Guggenheim Fellowship.
Research was also done while the author was at the Mathematical Sciences Research Institute in Berkeley, Brown University in Providence, and Ecole Normale Supérieure in Paris. Correspondence should be addressed to the author at Brown University, Dept. of Computer Science, Box 1910, Providence, R. I. 02912, USA.
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
R. Beigel and J. Gill. Personal communication (1986).
M. Blum, R. W. Floyd, V. Pratt, R. L. Rivest, and R. E. Tarjan. “Time Bounds for Selection,” Journal of Computer and System Sciences, 7 (1973), 448–461.
R. W. Floyd. “Permuting Information in Idealized Two-Level Storage,” Complexity of Computer Calculations, Plenum, New York (1972), 105–109.
Hong J. W. and H. T. Kung. “I/O Complexity: The Red-Blue Pebble Game,” Proceedings of the 13th Annual ACM Symposium on Theory of Computing, Milwaukee, WI (October 1981), 326–333.
D. E. Knuth. The Art of Computer Programming. Volume III: Sorting and Searching. Addison-Wesley, Reading, MA (1973).
F. T. Leighton. “Tight Bounds on the Complexity of Parallel Sorting,” IEEE Transactions on Computers, C-34(4), Special Issue on Sorting (April 1985).
E. E. Lindstrom and J. S. Vitter. “The Design and Analysis of BucketSort for Bubble Memory Secondary Storage,” IEEE Transactions on Computers, C-34(3) (March 1985), 218–233.
J. E. Savage and J. S. Vitter. “Parallelism in Space-Time Tradeoffs,” Advances in Computing Research, Volume 4: Special Issue on Parallel and Distributed Computing, JAI Press, Greenwich, CT (1987), 117–146.
C. L. Wu and T. Y. Feng. “The Universality of the Shuffle-Exchange Network,” IEEE Transactions on Computers, C-30(5) (May 1981), 324–332.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1987 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Aggarwal, A., Vitter, J.S. (1987). The I/O complexity of sorting and related problems. In: Ottmann, T. (eds) Automata, Languages and Programming. ICALP 1987. Lecture Notes in Computer Science, vol 267. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-18088-5_40
Download citation
DOI: https://doi.org/10.1007/3-540-18088-5_40
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-18088-3
Online ISBN: 978-3-540-47747-1
eBook Packages: Springer Book Archive