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)在决策树背景下定义)有界角度研究该问题。我们定义两棵给定二叉树 $T_1$ 和 $T_2$(含 $n$ 个内部节点)且秩不超过 $r$ 的秩有界旋转距离,记为 $d_r(T_1,T_2)$,其定义为在中间树秩不超过 $r$ 的约束下,将 $T_1$ 变换为 $T_2$ 所需的最短旋转序列长度。我们证明旋转距离问题可在多项式时间内归约为秩有界旋转距离问题。这激励了我们在组合与算法前沿对该问题的研究。观察到秩为 $1$ 的树恰好与斜树(每个内部节点至少有一个叶子子节点的二叉树)一致,我们在此前沿中得到以下结果:我们提出了一个 $O(n^2)$ 时间算法来计算 $d_1(T_1,T_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$ 时该界是渐近紧的。在证明上述定理的过程中,我们将二叉树与排列及双变量多项式建立联系,并证明了斜树情况下的若干刻画结果。