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$个内部节点的两棵二叉树的旋转距离(在多项式时间内)是树数据结构高度平衡研究中长期悬而未决的问题。本文首次从输入树的秩(由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$时渐近紧确。在证明上述定理的过程中,我们将二叉树关联到排列与双变量多项式,并给出斜树情形下的若干刻画结果。