A new tree inclusion algorithm

  • Authors:
  • Yangjun Chen;Yibin Chen

  • Affiliations:
  • Department of Applied Computer Science, University of Winnipeg, Winnipeg, Manitoba, Canada;Department of Applied Computer Science, University of Winnipeg, Winnipeg, Manitoba, Canada

  • Venue:
  • Information Processing Letters
  • Year:
  • 2006

Quantified Score

Hi-index 0.89

Visualization

Abstract

We consider the following tree-matching problem: Given labeled, ordered trees P and T, can P be obtained from T by deleting nodes? Deleting a node v entails removing all edges incident to v and, if v has a parent u, replacing the edges from u to v by edges from u to the children of v. The existing algorithm for this problem needs O(|T||leaves(P)|) time and O(|leaves(P)|min{DT, |leaves(T)|}) space, where leaves(P) (leaves(T)) stands for the number of the leaves of P(T), and DT for the height of T. In this paper, we present a new algorithm that requires O(|T|min{DP, |leaves(P)|}) time and no extra space, where Dp represents the height of P.