|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Note:
|
|
Example:
r(T) = lg(15) + lg(11) + 2lg(5) + 3lg(3)
Notes:
Before splay(3): r(T) = lg(15) + lg(11) + 2lg(5) + 3lg(3) After splay(3): r'(T) = lg(15) + lg(11) + lg(9) + lg(5) + 3lg(3) Change in balance: &Delta(r(T)) = r'(T) - r(T) = lg(9) - lg(5) |
|
|
|
(This is trivial because we added in the difference so the total will never become negative...)
|
To answer this question, we must look at the amortized cost of a tree rotation operation
Because: splay(x) = d tree rotations....
Notice that:
|
Notice also that:
|
Conclusion:
|
Notes:
|
Δ(r(T)) = r'(T) - r(T) = ( r'(1) + r'(2) + .... + r'(x) + r'(y) + .... + r'(n) ) - ( r(1) + r(2) + .... + r(x) + r(y) + .... + r(n) ) = ( r'(x) + r'(y) ) - ( r(x) + r(y) )
From: Therefore: Δ(r(T)) = r'(y) - r(x) < r'(x) - r(x) |
|
Example:
|
r( final tree ) - r( starting tree ) = r(T*) - r(T) = r(T*) - r''''''''(T) + ..... (all intermedtiate trees) + r''''(T) - r'''(T) + r'''(T) - r''(T) + r''(T) - r'(T) + r'(T) - r(T) < r*(x) - r''''''''(x) + .... + r''''(x) - r'''(x) + r'''(x) - r''(x) + r''(x) - r'(x) + r'(x) - r(x) (all but 2 terms cancel each other) = r*(x) - r(x)
|