# A simple optimal parallel algorithm for reporting paths in a tree

## Abstract

We present optimal parallel solutions to reporting paths between pairs of nodes in an *n*-node tree. Our algorithms are deterministic and designed to run on an exclusive read exclusive write parallel random-access machine (EREW PRAM). In particular, we provide a, simple optimal parallel algorithm for pre-processing the input tree such that the path queries can be answered efficiently. Our algorithm for preprocessing runs in *O*(log *n*) time using *O*(n/log *n*) processors. Using the preprocessing, we can report paths between *k* node pairs in *O*(log n + log *k*) time using *O*(*k* + (*n* + *S*)/log *n*) processors on an EREW PRAM, where *S* is the size of the output. In particular, we can report the path between a single pair of distinct nodes in *O*(log *n*) time using *O*(L/log *n*) processors, where *L* denotes the length of the path.

## Keywords

Leaf Node Input Tree Binary Search Tree Path Query Query Node## Preview

Unable to display preview. Download preview PDF.

## References

- [1]
- [2]R. Cole and U. Vishkin.
*The accelerated centroid decomposition technique for optimal parallel tree evaluation in logarithmic time*. Algorithmica,**3**(1988), pp. 329–346.Google Scholar - [3]A. Datta, A. Maheshwari, J.-R. Sack.
*Optimal parallel algorithms for direct dominance problems*. First Annual European Symposium on Algorithms, Lecture Notes in Computer Science, Vol. 726, pp. 109–120, Springer-Verlag, 1993.Google Scholar - [4]H.N. Djidjev, G.E. Pantziou and C.D. Zaroliagis.
*Computing Shortest Paths and Distances in Planar Graphs*. Proceedings 18th ICALP, Madrid, 1991, LNCS 510, pp. 327–338, Springer Verlag.Google Scholar - [5]M. T. Goodrich.
*Intersecting line segments in parallel with an output-sensitive number of processors*. SIAM J. Computing,**20**, (1991), pp. 737–755.Google Scholar - [6]L. J. Guibas and J. Hershberger.
*Optimal shortest path queries in a simple polygon*. J. of Computer and System Sciences**39**, pp. 126–152, 1989.Google Scholar - [7]R. Güting, O. Nurmi and T. Ottmann.
*Fast algorithms for direct enclosures and direct dominances*. J. Algorithms**10**(1989), pp. 170–186.Google Scholar - [8]J. JáJá.
*An Introduction to Parallel Algorithms*. Addison-Wesley, 1992.Google Scholar - [9]R. M. Karp and V. Ramachandran,
*Parallel Algorithms for Shared-Memory Machines*, Handbook of Theoretical Computer Science, Edited by J. van Leeuwen, Volume 1, Elsevier Science Publishers B.V., 1990.Google Scholar - [10]R. E. Ladner and M. J. Fisher.
*Parallel prefix computation*, JACM, 27(4) (1980), pp. 831–838.Google Scholar - [11]W. Paul, U. Vishkin and H. Wagener.
*Parallel dictionaries on 2–3 trees*. Proc. 10th ICALP Lecture Notes in Computer Science, Vol. 154, pp. 597–609, 1983.Google Scholar - [12]B. Schieber and U. Vishkin.
*On finding lowest common ancestors: Simplification and Parallelization*. SIAM. J. Computing,**17**(1988), pp. 1253–1262.Google Scholar - [13]R.E. Tarjan.
*Data Structures and Network Algorithms*. SIAM, Philadelphia, 1983.Google Scholar - [14]R. E. Tarjan and U. Vishkin.
*An efficient parallel biconnectivity algorithm*. SIAM J. Computing,**14**(1985), pp. 862–874.Google Scholar