Efficient EREW PRAM Algorithms for Parentheses-Matching

  • Authors:
  • S. K. Prasad;S. K. Das;C. C. Y. Chen

  • Affiliations:
  • -;-;-

  • Venue:
  • IEEE Transactions on Parallel and Distributed Systems
  • Year:
  • 1994

Quantified Score

Hi-index 0.01

Visualization

Abstract

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.