On Rotation Distance of Rank Bounded Trees*
Article type: Research Article
Authors: Anoop, S.K.M. | Sarma, Jayalal; *; †
Affiliations: Department of Computer Science and Engineering, Indian Institute of Technology Madras (IIT Madras), Chennai, India. [email protected] — [email protected]
Correspondence: [†] Corresponding author: Department of Computer Science and Engineering, Indian Institute of Technology Madras (IIT Madras), Chennai, India.
Note: [*] A preliminary version of the paper containing a subset of results appeared in the proceedings of the 28th International Computing and Combinatorics Conference (COCOON 2022).
Abstract: 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 in [1] in the context of decision trees). We define the rank-bounded rotation distance between two given full binary trees T1 and T2 (with n internal nodes) of rank at most r = max{rank(T1), rank(T2)}, denoted by dR(T1, T2), as the length of the shortest sequence of rotations that transforms T1 to T2 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 (full 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(n2) time algorithm for computing dR(T1, T2). That is, when the given full binary trees are skew trees (we call this variant the 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 dR(T1, T2) ≤ n2.•We show the following upper bound: for any two full binary trees T1 and T2 of rank r1 and r2 respectively, we have that: dR(T1, T2) ≤ n2(1 + (2n + 1)(r1 + r2 – 2)) where r = max{r1, r2}. This bound is asymptotically tight for r = 1. En route to our proof of the above theorems, we associate full binary trees to permutations and relate the rotation operation on trees to transpositions in the corresponding permutations. We give exact combinatorial characterizations of permutations that correspond to full binary trees and full skew binary trees under this association. We also precisely characterize the transpositions that correspond to the set of rotations in full binary trees. We also study bi-variate polynomials associated with binary trees (introduced by [2]), and show characterizations and algorithms for computing rotation distances for the case of full skew trees using them.
DOI: 10.3233/FI-242173
Journal: Fundamenta Informaticae, vol. 191, no. 2, pp. 79-104, 2024