# Fast integer merging on the EREW PRAM

## Abstract

We investigate the complexity of merging sequences of small integers on the EREW PRAM. Our most surprising result is that two sorted sequences of *n* bits each can be merged in *O*(log log *n)* time. More generally, we describe an algorithm to merge two sorted sequences of *n* integers drawn from the set {0,..., *m* −1} in *O*(log log *n*-flog*m*) time using an optimal number of processors. No sublogarithmic merging algorithm for this model of computation was previously known. The algorithm not only produces the merged sequence, but also computes the rank of each input element in the merged sequence. On the other hand, we show a lower bound of Ω(logmin{n,m}) on the time needed to merge two sorted sequences of length *n* each with elements in the set {0,..., *m*−1}, implying that our merging algorithm is as fast as possible for *m*=(log *n*)^{Ω(1)}. If we impose an additional stability condition requiring the ranks of each input sequence to form an increasing sequence, then the time complexity of the problem becomes ⊗(log *n*), even for *m*=2. Stable merging is thus harder than nonstable merging.

## Preview

Unable to display preview. Download preview PDF.

### References

- [1]P. Beame, M. Kik and M. Kutyłowski, Information broadcasting by exclusive read PRAMs, submitted.Google Scholar
- [2]O. Berkman, J. JáJá, S. Krishnamurthy, R. Thurimella and U. Vishkin, Some triply-logarithmic parallel algorithms, in Proc. 31st Annual IEEE Symposium on Foundations of Computer Science (1990), pp. 871–881.Google Scholar
- [3]G. Bilardi and A. Nicolau, Adaptive bitonic sorting: An optimal parallel algorithm for shared-memory machines,
*SIAM J. Comprit.***18**(1989), pp. 216–228.CrossRefGoogle Scholar - [4]A. Borodin and J. E. Hopcroft, Routing, merging, and sorting on parallel models of computation,
*J. Comput. Syst. Sci.***30**(1985), pp. 130–145.CrossRefGoogle Scholar - [5]
- [6]R. Cole and U. Vishkin, Deterministic coin tossing with applications to optimal parallel list ranking,
*Inform. and Control***70**(1986), pp. 32–53.CrossRefGoogle Scholar - [7]S. Cook, C. Dwork and R. Reischuk, Upper and lower time bounds for parallel random access machines without simultaneous writes,
*SIAM J. Comput.***15**(1986), pp. 87–97.CrossRefGoogle Scholar - [8]T. Hagerup and C. Rüb, Optimal merging and sorting on the EREW PRAM,
*Inform. Process. Lett.***33**(1989), pp. 181–185.CrossRefGoogle Scholar - [9]C. P. Kruskal, Searching, merging, and sorting in parallel computation.
*IEEE Trans. Comput.***32**(1983), pp. 942–946.MathSciNetGoogle Scholar - [10]S. Rajasekaran and J. H. Reif, Optimal and sublogarithmic time randomized parallel sorting algorithms,
*SIAM J. Comput.***18**(1989), pp. 594–607.CrossRefGoogle Scholar - [11]