next up previous
Next: 4. Binary Trees Up: 4.6 Amortized Algorithm Analysis Previous: 4.6.4 Example of Incrementing Binary Integers

4.6.5 Amortized Analysis of Splaying

Result 1

If the ith splaying step is a zig-zig or a zag-zag step at node x, then its amortized complexity ai satisfies

ai < 3(ri(x) - ri - 1(x))

See Figure 4.26.


  
Figure 4.26: A zig-zig at the ith splaying step
\begin{figure}
\par \centerline{\psfig{figure=figures/Fsplaystep.ps,width=5in}}
\end{figure}

Since | Ti(x)| = | Ti - 1(z)| as the subtree rooted at z before the splaying step has the same size as that rooted at x after the step.

Let

$ \alpha$ = | Ti - 1(x)|,$ \beta$ = | Ti(z)|, and $ \gamma$ = | Ti(x)|. Then observe that $ \alpha$ + $ \beta$ $ \leq$ $ \gamma$. This is because

Ti - 1(x)  contains components  x, A, B     (4.26)
Ti(z)  contains components  z, C, D     (4.27)
Ti(x$\displaystyle \mbox{contains all these components (plus $y$\space besides)}$.      

Thus by (*)

ri - 1(x) + ri(z) $\displaystyle \leq$ 2ri(x) - 2

$\displaystyle \Rightarrow$  2ri(x) - ri - 1(x) - ri(z) - 2 $\displaystyle \geq$ 0

Adding this to ($ \bullet$), we get

ai $\displaystyle \leq$ 2ri(x) - 2ri - 1(x) + ri(y) - ri - 1(y)

Before step i, y is the parent of x so that

| Ti - 1(y)| > | Ti - 1(x)|

After step i, x is the parent of y so that

| Ti(x)| > | Ti(y)|

Taking logarithms we have

ri - 1(y) > ri - 1(x) and  ri(x) > ri(y)

Thus we obtain

ai < 3ri(x) - 3ri - 1(x)

Similarly, we can show Results 2 and 3 below:


next up previous
Next: 4. Binary Trees Up: 4.6 Amortized Algorithm Analysis Previous: 4.6.4 Example of Incrementing Binary Integers
eEL,CSA_Dept,IISc,Bangalore