This Article 
   
 Share 
   
 Bibliographic References 
   
 Add to: 
 
Digg
Furl
Spurl
Blink
Simpy
Google
Del.icio.us
Y!MyWeb
 
 Search 
   
Efficient EREW PRAM Algorithms for Parentheses-Matching
September 1994 (vol. 5 no. 9)
pp. 995-1008

We present four polylog-time parallel algorithms for matching parentheses on anexclusive-read and exclusive-write (EREW) parallel random-access machine (PRAM)model. These algorithms provide new insights into the parentheses-matching problem.The first algorithm has a time complexity of O(log/sup 2/ n) employing O(n/(log n))processors for an input string containing n parentheses. Although this algorithm is notcost-optimal, it is extremely simple to implement. The remaining three algorithms, whichare based on a different approach, achieve O(log n) time complexity in each case, andrepresent successive improvements. The second algorithm requires O(n) processors andworking space, and it is comparable to the first algorithm in its ease of implementation.The third algorithm uses O(n/(log n)) processors and O(n log n) space. Thus, it iscost-optimal, but uses extra space compared to the standard stack-based sequentialalgorithm. The last algorithm reduces the space complexity to O(n) while maintaining thesame processor and time complexities. Compared to other existing time-optimal algorithms for the parentheses-matching problem that either employ extensive pipelining or use linked lists and comparable data structures, and employ sorting or a linked list ranking algorithm as subroutines, the last two algorithms have two distinct advantages. First, these algorithms employ arrays as their basic data structures, and second, they do not use any pipelining, sorting, or linked list ranking algorithms.

[1] R. Akker, H. Alblas, A. Nijholt, and P. Luttighuis, "An annotated bibliography on parallel parsing," Memoranda Informatica 89-67, Dept. Comput. Sci., Univ. of Twente, the Netherlands, Dec. 1989.
[2] R. J. Anderson, E. W. Mayr, and M. K. Warmuth, "Parallel approximation algorithms for bin packing,"Inform. Computation, vol. 82, pp. 262-277, Sept. 1989.
[3] F. Baccelli and T. Fleury, "On parsing arithmetic expressions in multiprocessing environment,"Acta Informatica. Berlin, Germany: Springer-Verlag, 1982, pp. 267-310.
[4] I. Bar-On and U. Vishkin, "Optimal generation of a computation tree form,"ACM Trans. Programming Lang. Syst., vol. 7, no. 2, pp. 659-663, 1985.
[5] O. Berkman, B. Schieber, and U. Vishkin, "Some doubly logarithmic optimal parallel algorithms based on finding all nearest smaller values," Tech. Rep. UMIACS-TR-88-79 CS-TR-2133, Dept. Comput. Sci., Univ. of Maryland, Oct. 1988.
[6] N. G. de Bruijn, D. E. Knuth, and S. O. Rice, "The average height of planted plane trees," in R. C. Reid Ed.,Graph Theory and Computing, Orlando, FL: Academic Press, 1972, pp. 15-22.
[7] C.-Y. Chen, "Efficient parallel algorithms and data structures related to trees," Ph.D. dissertation, Dept. Comput. Science, Univ. of North Texas, Denton, TX, Dec. 1991.
[8] C.-Y. Chen and S. K. Das, "A cost-optimal parallel algorithm for the parentheses matching problem on an EREW PRAM," inProc. 5th Int. Parallel Processing Symp., 1991, pp. 132-137.
[9] C.-Y. Chen and S. K. Das, "Breadth-first traversal of trees and integer sorting in parallel,"Inform. Processing Lett., vol. 41, pp. 39-49, Jan. 1992.
[10] R. Cole, "Parallel merge sort,"SIAM J. Comput., vol. 17, pp. 770-785, 1988.
[11] R. Cole and U. Vishkin, "Deterministic coin tossing with applications to optimal list ranking,"Inform. Control, vol. 70, pp. 32-53, 1986.
[12] R. Cole and U. Vishkin, "Approximate parallel scheduling, Part I: The basic technique with applications to optimal parallel list ranking in logarithmic time,"SIAM J. Comput., vol. 17, no. 1, pp. 128-142, Feb. 1988.
[13] S. K. Das and C.-Y. Chen, "Efficient parallel algorithms on interval graphs," inProc. Int. Conf. Parallel Architecture and Languages Europe (PARLE'92), Paris, France, June 1992,Lecture Notes in Computer Science 605. Berlin, Germany: Springer-Verlag, 1992, pp. 131-143.
[14] [I4] S. K. Das, C.-Y. Chen, G. Lewis, and S. Prasad, "Some fast parallel algorithms for parentheses matching," inProc. Int. Conf. Comput. Inform., 1991, pp. 443-454.
[15] S. K. Das and G. Lewis, "A divide-and-conquer algorithm for parentheses matching," Tech. Rep. CRPDC-91-5, Dept. Comput. Sci., Univ. North Texas, Denton, TX, June 1991.
[16] I. Bar-On and U. Vishkin, "Optimal generation of a computation tree form,"ACM Trans. Programming Lang. Syst., vol. 7, no. 2, pp. 659-663, 1985.
[17] N. Deo and S. Prasad, "Two EREW algorithms for parentheses matching," Tech. Rep. CS-TR-89-18, Dept. Comput. Sci., Univ. of Central Florida, Orlando, Nov. 1989.
[18] N. Deo and S. Prasad, "Two EREW algorithms for parentheses matching," inProc. 5th Int. Parallel Processing Symp., 1991, pp. 126-131.
[19] K. Diks and W. Rytter, "On optimal parallel computations for sequence of brackets,"Theoretical Comput. Sci., vol. 87, pp. 251-262, Sept. 1991.
[20] A. Gibbons and W. Rytter,Efficient Parallel Algorithms. Cambridge, England: Cambridge University Press, 1988.
[21] T. Hagerup and H. Shen, "Improved nonconstructive sequential and parallel integer sorting,"Inform. Processing Lett., vol. 36, pp. 57-63, 1990.
[22] M. A. Harrison,Introduction to Formal Language Theory. Reading, MA: Addison-Wesley, 1978.
[23] O. H. Ibarra, T. Jiang, and B. Ravikumar, "Some subclasses of context-free languages inNC1,"Inform. Processing Lett., vol. 29, pp. 111-118, 1988.
[24] S. K. Kim, "Optimal parallel algorithms on sorted intervals," inProc. 27th Annual Allerton Conf. on Communication, Control, and Computing, 1989, pp. 766-775.
[25] S. K. Kim, "Parallel algorithms for geometric intersection graphs," Tech. Rep. 90-07-04, Ph.D. dissertation, Dept. Comput. Sci. and Eng., Univ. of Washington, 1990.
[26] R. E. Ladner and M. J. Fischer, "Parallel prefix computation,"J. ACM, vol. 27, no. 4, pp. 831-838, Oct. 1980.
[27] C. Levcopoulos and O. Petersson, "Matching parentheses in parallel,"Discrete Applied Math., vol. 40, pp. 423-431, Dec. 1992.
[28] G. Lewis and S. K. Das, "Fast parallel algorithms for parentheses matching," Dept. Comput. Sci., Univ. of North Texas, Denton, TX, in preparation, 1993.
[29] E. W. Mayr and R. Werchner, "Optimal routing of parentheses on the hypercube," inProc. 4th Ann. Symp. on Parallel Algorithms and Architectures, 1992, pp. 109-117.
[30] S. Rajasekaran and S. Sen, "On parallel integer sorting,"ACTA Informatica, vol. 29, facs. 1, pp. 1-15, 1992.
[31] D. Sarkar and N. Deo, "Parallel algorithms for parentheses matching and generation of random balanced sequences of parentheses," inProc. 1st Int. Conf. Supercomputing, Athens, Greece,Lecture Notes in Computer Science 297. Berlin, Germany: Springer-Verlag, 1988, pp. 970-984.
[32] Y. N. Srikant, "Parallel parsing of arithmetic expression,"IEEE Trans. Comput., vol. 39, pp. 130-132, Jan. 1990.
[33] W. W. Tsang, T. W. Lam, and F. Chin, "An optimal EREW parallel algorithm for parentheses matching," inProc. Int. Conf. Parallel Processing, vol. 3, 1989, pp. 185-192.
[34] R. A. Wagner and Y. Han, "Parallel algorithms for bucket sorting and the data dependent prefix problem," inProc. Int. Conf. Parallel Processing, 1986, pp. 924-930.

Index Terms:
Index Termsparallel algorithms; parallel machines; random-access storage; computational complexity;pattern recognition; data structures; EREW PRAM algorithms; parentheses-matching;polylog-time parallel algorithms; exclusive-read and exclusive-write; parallelrandom-access machine; PRAM model; time complexity; input string; working space;space complexity; time-optimal algorithms; arrays; data structures
Citation:
S.K. Prasad, S.K. Das, C.C.Y. Chen, "Efficient EREW PRAM Algorithms for Parentheses-Matching," IEEE Transactions on Parallel and Distributed Systems, vol. 5, no. 9, pp. 995-1008, Sept. 1994, doi:10.1109/71.308536
Usage of this product signifies your acceptance of the Terms of Use.