Supercomputing pp 970-984 | Cite as

Parallel algorithms for parenthesis matching and generation of random balanced sequences of parentheses

  • Dilip Sarkar
  • Narsingh Deo
Session 10: Algorithms, Architectures And Performance III
Part of the Lecture Notes in Computer Science book series (LNCS, volume 297)


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.


Parallel Algorithm Binary Tree Search Tree Parallel Generation Binary Search Tree 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    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
  2. [2]
    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
  3. [3]
    P. R. Brent, "The Parallel Evaluation of General Arithmetic Expressions," J. ACM, Vol. 21, No. 2, April 1974, pp. 201–206.Google Scholar
  4. [4]
    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
  5. [5]
    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
  6. [6]
    D. E. Knuch, "A History of Writing Compilers," Comput. Autom., 1962, pp. 6–19.Google Scholar
  7. [7]
    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
  8. [8]
    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
  9. [9]
    U. Vishkin, "An Optimal Parallel Connectivity Algorithm," Discrete Appl. Math., Vol. 9, 1984, pp. 197–207.Google Scholar
  10. [10]
    J. C. Wyllie, "The Complexity of Parallel Computation," TR 79-387, Department of Computer Science, Cornell University, Ithaca, N.Y., 1979.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1988

Authors and Affiliations

  • Dilip Sarkar
    • 1
  • Narsingh Deo
    • 1
  1. 1.Department of Computer ScienceUniversity of Central FloridaOrlando

Personalised recommendations