Space-efficient parallel merging

  • Jyrki Katajainen
  • Christos Levcopoulos
  • Ola Petersson
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 605)


The problem of designing space-efficient parallel merging algorithms is examined. It is shown that two sorted sequences of lengths m and n, m≤n, can be merged in O(n/p+log n) time on an EREW PRAM with p processors, using only a constant amount of extra storage per processor. After a slight modification, the algorithm runs on a DCM (Direct Connection Machine) within the same resource requirements. This construction avoids the α(log n) slowdown when EREW PRAMs are simulated by DCMs. Moreover, using similar techniques, it is shown that merging can be accomplished in O(n/p+log log m) time on a CREW PRAM with p processors, and O(1) extra space per processor. Our algorithms use a sequential algorithm for in-place merging as a subroutine, and if this is stable, also the parallel algorithms are stable.

Key words

PRAM Direct Connection Machine merging space efficiency 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    S.G. Akl. The Design and Analysis of Parallel Algorithms. Prentice-Hall, Englewood Cliffs, N.J., 1989.Google Scholar
  2. [2]
    R.J. Anderson, E.W. Mayr, and M.K. Warmuth. Parallel approximation algorithms for bin packing. Inform. and Comput., 82:262–277, 1989.CrossRefGoogle Scholar
  3. [3]
    K.E. Batcher. Sorting networks and their applications. In Proc. of AFIPS Spring Joint Computer Conf., pages 307–314, 1968.Google Scholar
  4. [4]
    G. Bilardi and A. Nicolau. Adaptive bitonic sorting: An optimal parallel algorithm for shared memory models. SIAM J. Comput, 18:216–228, 1989.CrossRefGoogle Scholar
  5. [5]
    A. Borodin and J.E. Hopcroft. Routing, sorting, and merging on parallel models of computation. J. Comput. System Sci., 30:130–145, 1985.CrossRefGoogle Scholar
  6. [6]
    R. Cole. Parallel merge sort. SIAM J. Comput., 17:770–785, 1988.CrossRefGoogle Scholar
  7. [7]
    E. Dekel and I. Ozsvath. Parallel external merging. J. Parallel Distr. Comput., 6:623–635, 1989.CrossRefGoogle Scholar
  8. [8]
    D. Eppstein and Z. Galil. Parallel algorithmic techniques for combinatorial computation. Annual Reviews in Computer Science, 3:233–283, 1988.CrossRefGoogle Scholar
  9. [9]
    X. Guan and M.A. Langston. Time-space optimal parallel merging and sorting. IEEE Trans. Comput., 40:596–602, 1991.CrossRefGoogle Scholar
  10. [10]
    T. Hagerup and C. Rüb. Optimal merging and sorting on the EREW PRAM. Inform. Process. Lett., 33:181–185, 1989.CrossRefGoogle Scholar
  11. [11]
    B.-C. Huang and M.A. Langston. Practical in-place merging. Comm. ACM, 31:348–352, 1988.CrossRefGoogle Scholar
  12. [12]
    B.-C. Huang and M.A. Langston. Fast stable merging and sorting in constant extra space. In Proc. Internat. Conf. on Computing and Information, pages 71–80, 1989.Google Scholar
  13. [13]
    R.M. Karp and V. Ramachandran. A survey of parallel algorithms for shared memory machines. In J. van Leeuwen, editor, Handbook of Theoretical Computer Science. North-Holland, Amsterdam, The Netherlands, 1990.Google Scholar
  14. [14]
    M.A. Kronrod. An optimal ordering algorithm without a field of operation. Dokladi Akademia Nauk SSSR, 186:1256–1258, 1969.Google Scholar
  15. [15]
    C.P. Kruskal. Searching, merging, and sorting in parallel computation. IEEE Trans. Comput., C-32:942–946, 1983.MathSciNetGoogle Scholar
  16. [16]
    C.P. Kruskal, L. Rudolph, and M. Snir. A complexity theory of efficient parallel algorithms. Theoret. Comput. Sci., 71:95–132, 1990.CrossRefGoogle Scholar
  17. [17]
    H. Mannila and E. Ukkonen. A simple linear-time algorithm for in situ merging. Inform. Process. Lett., 18:203–208, 1984.CrossRefMathSciNetGoogle Scholar
  18. [18]
    F.P Preparata. New parallel-sorting schemes. IEEE Trans. Comput., C-27:669–673, 1978.Google Scholar
  19. [19]
    M.J. Quinn. Designing Efficient Algorithms for Parallel Computers. North-Holland, New York, 1987.Google Scholar
  20. [20]
    J. Salowe and W. Steiger. Simplified stable merging tasks. J. Algorithms, 8:557–571, 1987.CrossRefGoogle Scholar
  21. [21]
    B. Schieber and U. Vishkin. Finding all nearest neighbors for convex polygons in parallel: A new lower bound technique and a matching algorithm. Discrete Applied Math., 29:97–111, 1990.CrossRefGoogle Scholar
  22. [22]
    J.T. Schwartz. Ultracomputers. ACM Trans. Program. Lang. Syst., 2:484–521, 1980.CrossRefGoogle Scholar
  23. [23]
    Y. Shiloach and U. Vishkin. Finding the maximum, merging, and sorting in a parallel computational model. J. Algorithms, 12:88–102, 1981.CrossRefGoogle Scholar
  24. [24]
    M. Snir. On parallel searching. SIAM J. Comput., 15:688–708, 1985.CrossRefGoogle Scholar
  25. [25]
    H.S. Stone. Parallel processing with the perfect shuffle. IEEE Trans. Comput., C-20:153–161, 1971.Google Scholar
  26. [26]
    L.G. Valiant. General purpose parallel architectures. In J. van Leeuwen, editor, Handbook of Theoretical Computer Science. North-Holland, Amsterdam, The Netherlands, 1990.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1992

Authors and Affiliations

  • Jyrki Katajainen
    • 1
  • Christos Levcopoulos
    • 2
  • Ola Petersson
    • 2
  1. 1.Department of Computer ScienceUniversity of CopenhagenCopenhagen EastDenmark
  2. 2.Department of Computer ScienceLund UniversityLundSweden

Personalised recommendations