Computing the rotation distance between two binary trees with $n$ internal nodes efficiently (in $poly(n)$ time) is a long standing open question in the study of height balancing in tree data structures. In this paper, we initiate the study of this problem bounding the rank of the trees given at the input (defined by Ehrenfeucht and Haussler (1989) in the context of decision trees). We define the rank-bounded rotation distance between two given binary trees $T_1$ and $T_2$ (with $n$ internal nodes) of rank at most $r$, denoted by $d_r(T_1,T_2)$, as the length of the shortest sequence of rotations that transforms $T_1$ to $T_2$ with the restriction that the intermediate trees must be of rank at most $r$. We show that the rotation distance problem reduces in polynomial time to the rank bounded rotation distance problem. This motivates the study of the problem in the combinatorial and algorithmic frontiers. Observing that trees with rank $1$ coincide exactly with skew trees (binary trees where every internal node has at least one leaf as a child), we show the following results in this frontier : We present an $O(n^2)$ time algorithm for computing $d_1(T_1,T_2)$. That is, when the given trees are skew trees (we call this variant as skew rotation distance problem) - where the intermediate trees are restricted to be skew as well. In particular, our techniques imply that for any two skew trees $d(T_1,T_2) \le n^2$. We show the following upper bound : for any two trees $T_1$ and $T_2$ of rank at most $r_1$ and $r_2$ respectively, we have that: $d_r(T_1,T_2) \le n^2 (1+(2n+1)(r_1+r_2-2))$ where $r = max\{r_1,r_2\}$. This bound is asymptotically tight for $r=1$. En route our proof of the above theorems, we associate binary trees to permutations and bivariate polynomials, and prove several characterizations in the case of skew trees.
翻译:计算两个具有 $n$ 个内部节点的二叉树的旋转距离(在 $poly(n)$ 时间内求解)是树数据结构中高度平衡问题的一个长期未解难题。本文首次在输入树秩有界(由 Ehrenfeucht 和 Haussler (1989) 在决策树背景下定义)的约束下研究该问题。我们定义两个秩不超过 $r$ 的二叉树 $T_1$ 和 $T_2$(含 $n$ 个内部节点)的秩有界旋转距离 $d_r(T_1,T_2)$ 为:在限制中间树的秩均不超过 $r$ 的前提下,将 $T_1$ 转换为 $T_2$ 所需的最短旋转序列长度。我们证明旋转距离问题可在多项式时间内归约为秩有界旋转距离问题,这推动了该问题在组合与算法前沿领域的研究。注意到秩为 $1$ 的树恰为斜树(即每个内部节点至少有一个叶子作为子节点的二叉树),我们在此前沿领域获得以下结果:提出计算 $d_1(T_1,T_2)$ 的 $O(n^2)$ 时间算法。当给定树为斜树时(我们将此变体称为斜旋转距离问题),中间树也必须保持斜树结构。特别地,我们的技术表明任意两个斜树满足 $d(T_1,T_2) \le n^2$。我们证明以下上界:对于秩分别不超过 $r_1$ 和 $r_2$ 的任意两棵树 $T_1$ 和 $T_2$,有 $d_r(T_1,T_2) \le n^2 (1+(2n+1)(r_1+r_2-2))$,其中 $r = \max\{r_1,r_2\}$。该界在 $r=1$ 时渐近紧致。在证明上述定理的过程中,我们将二叉树与置换和二元多项式建立关联,并在斜树情形下证明了多项表征性质。