**Abstract**. The maximum common embedded subtree problem, which
generalizes the minor containment problem on trees, is reduced for
ordered trees to a variant of the longest common subsequence problem,
called the longest common balanced sequence problem. While the maximum
common embedded subtree problem is known to be APX-hard for unordered
trees, an exact solution for ordered trees can be found in polynomial
time. In this paper, a dynamic programming algorithm is presented that
solves the longest common balanced sequence problem, and thus the
maximum common embedded subtree problem, in
*O(n*_{1}n_{2}min(d_{1},l_{1})
min(d_{2},l_{2})) time, on ordered trees with
*n*_{1} and *n*_{2} nodes, of depth
*d*_{1} and *d*_{2}, and with
*l*_{1} and *l*_{2} leaves,
respectively.