A pattern matching algorithm in binary trees

  • Keiji Kojima
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 147)


An algorithm is presented which searches all occurrences of a given complete binary tree in another, in running time proportional to the sum of the numbers of their nodes. The algorithm is essentially an application of Knuth-Morris-Pratt's string matching algorithm. An extension to more general tree structures is also described.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    Donald E. Knuth, Fundamental Algorithm, The art of Computer Programming, Vol.1, Addison-Wesley, Reading,Mass., 1968; 2nd edition 1973.Google Scholar
  2. [2]
    Malcom C. Harrison, Implementation of the substring test by hashing, Comm.ACM, 14 (1971), pp 777–779.Google Scholar
  3. [3]
    D.E. Knuth, J.H. Morris, Jr., V.R. Pratt, Fast Pattern Matching in Strings, SIAM J. of Computer, Vol.6, No.2, June 1977, pp.323–350.Google Scholar
  4. [4]
    Alfred.V. Aho and Margaret J. Corasick, Efficient string matching: An aid to bibliographic search, Comm.ACM, 18 (1975), pp.333–340.Google Scholar
  5. [5]
    R.S. Boyer and J.S. Moore, A fast string searching algorithm, Comm.ACM, Vol.20, No.2, Oct. 1977.Google Scholar
  6. [6]
    C.M. Hoffmann and M.J. O'donnell, Pattern Matching in Trees, Journal of ACM, Vol.29, No.1, January 1982, pp.68–95.Google Scholar
  7. [7]
    K.Kojima, A linear tree matching algorithm, Master Thesis, Kyoto University.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1983

Authors and Affiliations

  • Keiji Kojima
    • 1
  1. 1.Central Research LaboratoryHitachi, Ltd.Kokubunji, TokyoJapan

Personalised recommendations