day6 1/28/98 quote of the day ``This is a big mess, right?''
Always move an element you are interested in to the root. Capitol letters are trees and lowercase letters are elements in the following
Split(i,S) will do Insert(i,S) then Splay(i,S) where Splay(i,S) moves i to the root of the tree by rotations.
Definitions
3 credit cards to charge costs to:
visa, mastercard (MC), americanexpress (AE)
[`(m)] is a measure of how balanced a tree is. For a completely unbalanced tree, [`(m)](S) = O(n*log(n)) . For a totally balanced tree, [`(m)](S) = O(n)
after m splay(x,S) calls
in all cases [`(m)](x¢) ³ m(x) because x is moving up in the tree.
The lemma, together with m(x) £ log(n) means MC £ m*log(n) because m(x) can increase at least 1 to log(n) .
The total ``something more'' is less than 2*log(n) for each splay.
Visa £ [`(m)](Sbegin)-[`(m)](Send)+2m*log(n)
proof: add up AE, MC, and Visa