Efficient Reorganization of Binary Search Trees
Author
Hofri, Micha; Shachnai, Hadas
Date
November 13, 1996Abstract
We consider the problem of maintaining a binary search tree that minimizes the average access cost needed to satisfy randomly generated requests. We analyze scenarios in which the accesses are generated according to a vector of fixed probabilities which is unknown. Our approach is statistical. We devise policies for modifying the tree structure dynamically, using rotations of accessed elements towards the root. The aim is to produce good approximations of the optimal structure of the tree, while keeping the number of rotations as low as possible. The heuristics we propose achieve a close approximation to the optimal BST, with lower organization costs than any previously studied. First the {\em Move Once} (MO) rule is introduced. The average access cost to the tree under this rule is shown to equal the value achieved by the common rule Move to the Root (MTR). The advantage of MO over MTR and other rules is that it relocates each of the items in the tree at most once. We show that the total cost of modifying the tree by the MO rule is O(n lg n) rotations (in a tree with n items). This holds for a sequence of accesses of arbitrary length, independently of the access probabilities. Then the MO rule is combined with the use of reference counters, one per item, that provide estimates of the reference probabilities. We define the rule MOUCS, and show, that for any delta and alpha > 0,it achieves a cost that approaches the optimum up to a difference of $\delta$with probability higher than 1alpha, within a number of accesses that is proportional to $n/(\alpha \delta^2)$.\\
Citation
Type
Technical report