Parallel algorithms for parenthesis matching and generation of random balanced sequences of parentheses
Parallel parenthesis-matching algorithm has in the past been used to design parallel algorithms for generation of computation tree forms and parsing. In this paper we present a parallel parenthesis-matching algorithm. A variant of binary search tree is constructed in parallel. The search tree is used to find the matching of each parenthesis. The algorithm takes O(log n) time on a (n / log n)-processor CREW-PRAM. We also present an O(log n)-time parallel algorithm for generation of random sequences of parentheses. These two algorithms can be used to design an O(log n)-time parallel algorithm for generation of a class of random permutations.
KeywordsParallel Algorithm Binary Tree Search Tree Parallel Generation Binary Search Tree
Unable to display preview. Download preview PDF.
- D. B. Arnold and M. R. Sleep, "Uniform Random Generation of Balanced Parenthesis Strings," ACM Trans. Program. Lang. Syst., Vol. 2, No. 1, Jan. 1980, pp. 122–128.Google Scholar
- I. Bar-On and U. Vishkin, "Optimal Parallel Generation of a Computation Tree Form," ACM Trans. Program. Lang. Syst., Vol. 7, No. 2, April 1985, pp. 348–357.Google Scholar
- P. R. Brent, "The Parallel Evaluation of General Arithmetic Expressions," J. ACM, Vol. 21, No. 2, April 1974, pp. 201–206.Google Scholar
- Y. F. Chin and I. Chen, "Efficient Parallel Algorithms for Some Graph Problems," Commun. ACM, Vol. 25, No. 3, March 1982, pp. 659–665.Google Scholar
- E. Dekel and S. Sahni, "Parallel Generation of Postfix and Tree Forms," ACM Trans. Program. Lang. Syst., Vol. 5, No. 3, July 1983, pp. 300–317.Google Scholar
- D. E. Knuch, "A History of Writing Compilers," Comput. Autom., 1962, pp. 6–19.Google Scholar
- G. L. Miller and J. H. Reif, "Parallel Tree Contraction and Its Application," in Proc. Symposium on Foundations of Computer Science, IEEE, 1985, pp. 478–489.Google Scholar
- D. Sarkar and N. Deo, "An Optimal Parallel Parsing Algorithm for a Class of Block-Structured Languages," TR-CS-87-01, Department of Computer Science, University of Central Florida, Orlando, Florida, Jan. 1987.Google Scholar
- U. Vishkin, "An Optimal Parallel Connectivity Algorithm," Discrete Appl. Math., Vol. 9, 1984, pp. 197–207.Google Scholar
- J. C. Wyllie, "The Complexity of Parallel Computation," TR 79-387, Department of Computer Science, Cornell University, Ithaca, N.Y., 1979.Google Scholar