Amortized Analysis and Splay Trees
Inge Li Gørtz
CLRS Chapter 17 Jeff Erickson notes
Amortized Analysis and Splay Trees Inge Li Grtz CLRS Chapter 17 Je ff - - PowerPoint PPT Presentation
Amortized Analysis and Splay Trees Inge Li Grtz CLRS Chapter 17 Je ff Erickson notes Today Amortized analysis Multipop-stack Dynamic tables Splay trees Dynamic tables Problem. Have to assign size of table at
CLRS Chapter 17 Jeff Erickson notes
3
4
3 5 1 7 8
3 5 1 7 8 2 3 4 6 3 5 3 3 5 1 3 5 1 7 3 5 1 7 8 2 3 5 1 7 8 2 3 3 5 1 7 8 2 3 4
5
x x x x x x x x x x x x x x x x x x x x x x x x x x x
💱 💱 💱 💱 💱 💱 💱 💱 💱 💱 💱 💱 💱 💱 💱 💱 💱 💱 💱 💱 💱 💱
x x x x x x x x x x x x
💱 💱
x x x x x x x x x x x x x x x x
3 5 1 7 8 2 3 4 6 3 5 1 7 8 2 3 4 3 5 1 7 8 2 3 4 6 3 5 1 7 8 2 3 4
13
3 5 1 7 8 3 5 1 7
14
x x x x x x
💱 💱
x x x x x x x
x x x x x x x
💱
x x x x x x x x
x x x x x x x x x x x
💱 💱 💱 💱 💱 💱
x x x x x x x x x x x x
💱 💱
💱 💱 = 3
x x x x x x x x x x x x x x x x x
💱 💱 💱 💱 💱 💱 💱 💱 💱 💱 💱 💱
💱 💱
x x x x x x x
💱 💱 💱 💱 💱 💱
💱
💱 💱 💱 💱
x x x x x x x x x x x x
💱 💱
💱 💱
x x x x x x x x x x x
💱
x x x x x x x x
💱
💱 = 2
x x x x x x x
💱
x x x x x x x
💱
💱 = 2
x x x x x x
x y
a b c a b c
y x
right left
x x x w w w z z z
a b c d a a b b c c d d
x x x y y y z z z
a a a b b b c c c d d d
x x x w w w z z z
a b c d a a b b c c d d
x x x y y y z z z
a a a b b b c c c d d d
1 2 3 6 4 5 7 10 9 8
1 2 3 6 4 5 7 10 9 8
1 2 3 6 4 5 7 10 9 8
1 2 3 6 4 5 7 10 9 8
1 2 3 6 4 5 7 10 9 8
1 2 3 6 4 5 7 10 9 8
1 2 3 6 4 5 7 10 9 8
1 2 3 6 4 5 7 10 9 8
1 2 3 6 4 5 7 10 9 8
1 2 3 6 4 5 7 10 9 8
1 2 3 6 4 5 7 10 9 8
1 2 3 6 4 5 7 10 9 8
1 2 3 6 4 5 7 10 9 8
1 2 3 6 4 5 7 10 9 8
v x Find x and splay it x Delete x v Find the predecessor v of x and splay it v Make v the parent of the root of the right subtree
1 2 3 6 4 5 7 10 9 8
1 2 3 6 4 5 7 10 9 8
1 2 3 4 5 7 10 9 8
v
v
k
i=0
k−1
i=1
x y
a b c a b c
y x
right left
x x x w w w z z z
a b c d a a b b c c d d