Abstract

In this paper we consider ordered h-ary trees, that is, trees whose nodes have exactly h sons; and ranked trees, where the number of sons depends on the node label. We define the subtree distance between two ordered h-trees T 1, T 2 as the number of subtrees to be inserted or deleted in T 1 to obtain T 2, and consider the problem of finding all the occurences, with bounded distance k, of an h-ary tree P as a subtree of another h-ary tree T. This problem is solved in time O(h|P| + max(h, k)|T|) . We then study the classical problem of finding all the occurences of a ranked tree P in another tree T, where the two trees are labelled, and a special label v in the leaves of P stands for any subtree in T. An extension of the previous algorithm allows to solve this problem in time O(| P| + k| T|). where k is the number of labels v in P. We also discuss some natural variants of the two problems.

Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.