This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CS294-5: Great Algorithms Professor: Richard Karp April 17, 2006 Scribe: Vinod Prabhakaran Notes for Lecture 23 In this lecture we analyze the splay tree algorithm presented in the last lecture. Splay tree algorithm is an elegant algorithm for maintaining a dictionary which stores its keys in a binary search tree. The algorithm attempts to keep the tree balanced and can be thought of as an analogue of the move-to-front algorithm from one of the previous lectures. The main intuition of the analysis is as follows: The move-to-root action of the algorithm results in approximately a doubling of the work required to perform the search part of the operation required to perform the FIND, INSERT, or DELETE action. When the search is short, this doubling is does not add significantly to the overall amortized cost, but when the search is long, the resulting tree is better balanced than the tree we began with. We will define an appropriate potential function to measure the effect of each step on the tree balance. In order to define our potential function, we need some preliminary defini- tions: For each node X , we define s ( X ) as the number of nodes in the subtree rooted at X , and the rank , r ( X ) of the node X as lg ( s ( X )), where the lg stands for log to the base 2. The potential of the tree T is ( T ) = X r ( X )....
View Full Document
- Fall '11