## Abstract

The edit distance between two ordered rooted trees with vertex labels is the minimum cost of transforming one tree into the other by a sequence of elementary operations consisting of deleting and relabeling existing nodes, as well as inserting new nodes. In this article, we present a worst-case O(n ^{3})-time algorithm for the problem when the two trees have size n, improving the previous best O(n^{3} log n)-time algorithm. Our result requires a novel adaptive strategy for deciding how a dynamic program divides into subproblems, together with a deeper understanding of the previous algorithms for the problem. We prove the optimality of our algorithm among the family of decomposition strategy algorithmswhich also includes the previous fastest algorithmsby tightening the known lower bound of ω(n^{2} log^{2} n) to ω(n^{3}), matching our algorithm's running time. Furthermore, we obtain matching upper and lower bounds for decomposition strategy algorithms of Θ(nm^{2} (1 + log n/m)) when the two trees have sizes m and n and m < n.

Original language | English |
---|---|

Article number | 2 |

Journal | ACM Transactions on Algorithms |

Volume | 6 |

Issue number | 1 |

DOIs | |

State | Published - 1 Dec 2009 |

Externally published | Yes |

## Keywords

- Decomposition strategy
- Dynamic programming
- Edit distance
- Ordered trees
- Tree edit distance

## ASJC Scopus subject areas

- Mathematics (miscellaneous)