We present an algorithm for maintaining binary search trees. The amortized complexity per INSERT or DELETE is O(log n) while the worst-case cost of a SEARCH is O(log n). Scapegoat trees, unlike most balanced-tree schemes, do not require keeping extra data (e.g. “colors” or “weights”) in the tree nodes. Each node in the tree contains only a key value and pointers. to its two children. Associated with the root of the whole tree are the only two extra values needed by the scapegoat scheme: the number of nodes in the whole tree, and the maximum number of nodes in the tree since the tree was last completely rebuilt. In a scapegoat tree a typical rebalancing operation begins at a leaf, and successively examines higher ancestors until a node (the “scapegoat”) is found that is so unbalanced that the entire subtree rooted at the scapegoat can be rebuilt at zero cost, in an amortized sense. Hence the name.
Igal Galperin, Ronald L. Rivest