, Volume 73, Issue 4, pp 623–636 | Cite as

RAM-Efficient External Memory Sorting

  • Lars ArgeEmail author
  • Mikkel Thorup


In recent years a large number of problems have been considered in external memory models of computation, where the complexity measure is the number of blocks of data that are moved between slow external memory and fast internal memory (also called I/Os). In practice, however, internal memory time often dominates the total running time once I/O-efficiency has been obtained. In this paper we initiate a study of algorithms for fundamental problems that are simultaneously I/O-efficient and internal memory efficient in the RAM model of computation. For sorting the conventional wisdom is to use merging base algorithms in external memory but we describe how this leads to suboptimal RAM performance. However, by using a splitting based algorithm in combination with existing RAM sorting techniques we obtain a sorting algorithm that is both I/O and RAM model efficient. Furthermore, we design an I/O- and RAM-efficient priority queue. Finally, we prove a sorting lower bound that shows that in most cases our results are optimal both in terms of I/O and internal computation.


I/O algorithms RAM algorithms External memory algorithms Sorting Priority queue 


  1. 1.
    Aggarwal, A., Vitter, J.S.: The input/output complexity of sorting and related problems. Commun. ACM 31(9), 1116–1127 (1988)CrossRefMathSciNetGoogle Scholar
  2. 2.
    Arge, L.: The buffer tree: a technique for designing batched external data structures. Algorithmica 37(1), 1–24 (2003)CrossRefMathSciNetzbMATHGoogle Scholar
  3. 3.
    Arge, L., Miltersen, P.B.: On showing lower bounds for external-memory computational geometry. In: Abello, J., Vitter, J.S. (eds.) External Memory Algorithms and Visualization. DIMACS series, pp. 139–160. American Mathematical Society, Rhode Island (1999)Google Scholar
  4. 4.
    Brodal, G.S., Katajainen, J.: Worst-case efficient external-memory priority queues. In: Proc. Scandinavian Workshop on Algorithms Theory, LNCS 1432, pp. 107–118 (1998)Google Scholar
  5. 5.
    Comer, D.: The ubiquitous B-tree. ACM Comput. Surv. 11(2), 121–137 (1979)CrossRefzbMATHGoogle Scholar
  6. 6.
    Fadel, R., Jakobsen, K.V., Katajainen, J., Teuhola, J.: Heaps and heapsort on secondary storage. Theor. Comput. Sci. 220(2), 345–362 (1999)CrossRefMathSciNetzbMATHGoogle Scholar
  7. 7.
    Frigo, M., Leiserson, C.E., Prokop, H., Ramachandran, S.: Cache-oblivious algorithms. In: Proceedings of the IEEE Symposium on Foundations of Computer Science, pp. 285–298 (1999)Google Scholar
  8. 8.
    Goodrich, M.T., Tsay, J.J., Vengroff, D.E., Vitter, J.S.: External-memory computational geometry. In: Proceedings of the IEEE Symposium on Foundations of Computer Science, pp. 714–723 (1993)Google Scholar
  9. 9.
    Han, Y.: Deterministic sorting in \(O(n \log \log n)\) time and linear space. In: Proceedings of the ACM Symposium on Theory of Computation, pp. 602–608 (2002)Google Scholar
  10. 10.
    Han, Y., Thorup, M.: Integer sorting in \(O(n\sqrt{\log \log n})\) expected time and linear space. In: Proceedings of the IEEE Symposium on Foundations of Computer Science, pp. 135–144 (2002)Google Scholar
  11. 11.
    Kumar, V., Schwabe, E.: Improved algorithms and data structures for solving graph problems in external memory. In: Proceedings of the IEEE Symposium on Parallel and Distributed Processing, pp. 169–177 (1996)Google Scholar
  12. 12.
    Thorup, M.: Equivalence between priority queues and sorting. J. ACM 54(6), 28 (2007)CrossRefMathSciNetGoogle Scholar
  13. 13.
    Vitter, J.S.: External memory algorithms and data structures: dealing with MASSIVE data. ACM Comput. Sur. 33(2), 209–271 (2001)CrossRefGoogle Scholar

Copyright information

© Springer Science+Business Media New York 2015

Authors and Affiliations

  1. 1.Center for Massive Data Algorithmics (MADALGO), Department of Computer ScienceAarhus UniversityAarhusDenmark
  2. 2.Department of Computer ScienceUniversity of CopenhagenCopenhagenDenmark

Personalised recommendations