A Pattern Matching Algorithm in Binary Trees.
Keiji Kojima · 1982
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.