Optimal speedups for parallel pattern matching in trees

  • R. Ramesh
  • I. V. Ramakrishnan
Efficiency Of Rewriting
Part of the Lecture Notes in Computer Science book series (LNCS, volume 256)


Tree pattern matching is a fundamental operation that is used in a number of programming tasks such as code optimization in compilers, symbolic computation, automatic theorem proving and term rewriting. An important special case of this operation is linear tree pattern matching in which an instance of any variable in the pattern occurs at most once. If n and m are the number of nodes in the subject and pattern tree respectively and if no restriction is placed on the structure of the trees, then the fastest known sequential algorithm for linear tree pattern matching requires O(nm) time in the worst case.

In this paper we present a parallel algorithm for linear tree pattern matching on a PRAM (parallel random access machine) model. Our algorithm exhibits optimal speedup, in the sense that its processor-time product matches the worst-case time complexity of the fastest sequential algorithm.


Parallel Algorithm Automatic Theorem Prove Term Match Parallel Random Access Machine Optimal Speedup 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. [1]
    A.V. Aho and M. Ganapathy, Efficient Tree Pattern Matching: An Aid to Code Generation, Proceedings of the Eleventh ACM Symposium on Principles of Programming Languages, 1984 pp. 334–340.Google Scholar
  2. [2]
    R. P. Brent, The Parallel Evaluation of General Arithmetic Expressions, JACM 21,2 (1974), pp. 201–206.Google Scholar
  3. [3]
    G. Collins, The SAC-1 System: An introduction and Survey, Proceedings of the Second ACM Conference on Symbolic and Algebraic Manipulation, 1971, pp. 144–152.Google Scholar
  4. [4]
    C. Dwork, P. Kanellakis and L. Stockmeyer, Parallel Algorithm for Term Matching, Eighth Conference on Automated Deduction, Oxford University, July 1986.Google Scholar
  5. [5]
    S. Fortune and J. Wyllie, Parallelism in Random Access Machines, Proceedings of the Tenth ACM Symposium of Theory of Computing, 1978 pp. 114–118.Google Scholar
  6. [6]
    Z. Galil, Optimal Parallel Algorithms, VLSI: Algorithms and Architectures, P. Bertolazzi and F. Luccio (editors), Elsevier Science Publishers B.V. (North Holland), 1985 pp. 3–10.Google Scholar
  7. [7]
    J. Guttag, E. Horowitz and D.R. Musser, Abstract Data Types and Software Validation, CACM 21, 12, December 1978 pp. 1048–1064.Google Scholar
  8. [8]
    C.M. Hoffmann and M.J. O'Donnell, Pattern Matching in Trees, JACM 29, 1, 1982 pp. 68–95.Google Scholar
  9. [9]
    C.M. Hoffmann and M.J. O'Donnell, An Interpreter Generator using Tree Pattern Matching, Proceedings of the Sixth Annual ACM Symposium on Principles of Programming Languages, 1979 pp. 169–179.Google Scholar
  10. [10]
    R. Karp, R.E. Miller and A. Rosenberg, Rapid Identification of Repeated Patterns in Strings, Trees and Arrays, Proceedings of the Fourth Annual ACM Symposium on Theory of Computing, Denver, Colorado 1972, pp. 125–136.Google Scholar
  11. [11]
    H. Kron, Tree Templates and Subtree Transformational Grammars, Ph.D Dissertation, University of California, Santa Cruz, 1975.Google Scholar
  12. [12]
    C.P. Kruskal, L. Rudolph and M. Snir, Efficient Parallel Algorithms for Graph Problems, Proceedings of the 1986 International Conference on Parallel Processing, pp. 180–185.Google Scholar
  13. [13]
    P. W. Purdom, Jr. and C. A. Brown, Fast Many-to-One Matching Algorithms, Proceedings of the First International Conference on Rewriting Techniques and Applications, 1985, Dijon, France.Google Scholar
  14. [14]
    R. Ramesh, R. M. Verma, T. Krishnaprasad and I.V. Ramakrishnan, Term Matching on Parallel Computers, SUNY Stony Brook Computer Science Dept. Tech Report No. 86/20, November 1986 (To appear in the Proceedings of Fourteenth ICALP).Google Scholar
  15. [15]
    R. E. Tarjan and U. Vishkin, Finding Bi-Connected Components and Computing Tree Functions in Logarithmic Parallel Time, Proceedings of the Twentyfifth IEEE Symposium on Foundations of Computer Science, 1984, pp. 12–20.Google Scholar
  16. [16]
    U. Vishkin, Optimal Parallel Pattern Matching in Strings, Twelfth ICALP, Lecture Notes in Computer Science 194, Springer-Verlag, 1985, pp. 497–508.Google Scholar
  17. [17]
    R. M. Verma, T. Krishnaprasad, I.V. Ramakrishnan, An Efficient Parallel Algorithm for Term Matching, Sixth International Conference on Foundations of Software Technology and Theoretical Computer Science, Lecture notes in Computer Science, Springer-Verlag, December 1986, pp. 504–518Google Scholar
  18. [18]
    R. Cole and U. Vishkin, Deterministic Coin Tossing and Accelerating Cascades: Micro and Macro Techniques for Designing Parallel Algorithms, Proceedings of the Eithteenth Annual ACM Symposium on Theory of Computing, 1986, pp. 206–219.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1987

Authors and Affiliations

  • R. Ramesh
    • 1
  • I. V. Ramakrishnan
    • 1
  1. 1.Department of Computer ScienceState University of New York at Stony BrookStony Brook

Personalised recommendations