Amortized Rotation Cost in AVL Trees
Abstract
An AVL tree is the original type of balanced binary search tree. An insertion in an -node AVL tree takes at most two rotations, but a deletion in an -node AVL tree can take . A natural question is whether deletions can take many rotations not only in the worst case but in the amortized case as well. A sequence of successive deletions in an -node tree takes rotations, but what happens when insertions are intermixed with deletions? Heaupler, Sen, and Tarjan conjectured that alternating insertions and deletions in an -node AVL tree can cause each deletion to do rotations, but they provided no construction to justify their claim. We provide such a construction: we show that, for infinitely many , there is a set of {\it expensive} -node AVL trees with the property that, given any tree in , deleting a certain leaf and then reinserting it produces a tree in , with the deletion having done rotations. One can do an arbitrary number of such expensive deletion-insertion pairs. The difficulty in obtaining such a construction is that in general the tree produced by an expensive deletion-insertion pair is not the original tree. Indeed, if the trees in have even height , deletion-insertion pairs are required to reproduce the original tree.
Cite
@article{arxiv.1506.03528,
title = {Amortized Rotation Cost in AVL Trees},
author = {Mahdi Amani and Kevin A. Lai and Robert E. Tarjan},
journal= {arXiv preprint arXiv:1506.03528},
year = {2015}
}