2. so... what’s this all about?
Introducing
SBB(k) trees
Before getting to SBB(k) trees, we
really have a long way to go... What
about a shortcut?
AVL-Tree
(a,b)-Tree
SBB(k)
Tree
Binary
Search Tree
B-Tree
SBB
Tree
SBB-tree and SBB(k)-tree introduce
the concept of “pseudo-node”!
Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
3. some definitions...
Matrioska-like definitions, let’s start
from the most inner one...
Optimally balanced
The difference between
its maximum and minimum
heights <= 1
Introducing important
concepts: Pseudo-Node
Minimum
height
Maximum
height
Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
4. Let’s open the box and
see what’s inside...
Defining SBB(k)-trees
SBB(k)-tree is a binary-tree which
satisfies the following 3 criteria...
The
Pseudo-Root
is optimally
balanced and has a maximum
height <= (k+1).
All other
Pseudo-Nodes
have a
minimum height >= (k) and a
maximum height <= (k+1).
The number of
Pseudo-Nodes
on the path
from the root to a leaf is the same for all leaves.
Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
5. 47
The importance of k
Let’s draw some
trees...
35
64
19
9
50
40
28
38
44
48
69
52
66
77
47
35
64
40
k -> k++
19
9
38
28
44
50
48
69
52
66
77
What happens when k
increases?
Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
6. Caging
SBB(k)-trees?
Height upper-bound
START
h ( ab-tree ) 1+ log a
h ( SBB(k)-tree )
n +1
2
= 1+
log ( n + 1) 1
log ( 2 k )
log ( n + 1) + h ( ab-tree )
log ( n + 1) + 1+
1+
1
k
log ( n + 1) 1
log ( 2 k )
log ( n + 1) + 1
1
k
h ( SBB(k)-tree )
1
1+
k
log ( n + 1)
Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
8. Update algorithms
ops.insertion
Inserting a node in the tree.
Analyzing algorithms for
insertion and deletion in
SBB(k)-trees
int ops.insertion(pn P, int c) {
return (c==0) ? ops.balance(P,null) :
/*(c==1)*/ ops.split(P,null);
}
ops.deletion
Deleting a node in the tree.
int ops.deletion(pn P, pn S, int c) {
return (c==0x00) ? ops.balance(P,S) :
ops.rotation() +
(c==0x10) ? ops.coBalance(P,S) :
/*(c==0x11)*/ ops.join(P,S);
}
Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
9. Inspecting ops.balance
and most important issues
Restructuring Work
A very important
operation is
Restructuring.
It is needed to keep the
tree a SBB(k)-tree.
Restructuring is
performed by the
Balance operation.
Restructuring Work
=
ops.balance
insertion
2 k+2
2P
max ( ll ( P ) ,rl ( P ))
log ( P + 1)
2k 4
deletion
3 2 k+1 2k 7
Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
10. Binding k to n and
seeing what happens
Improving height
log log ( n + 1)
log log ( 3n )
k
Recalling dynamic arrays,
we can create a range for k
At the begging, we proved the upper-bound. By
tuning k, we improve the upper-bound
h ( SBB(k)-tree )
k = O ( log log n )
O ( log n )
1+
1
k
1+
1
log log ( n + 1)
log ( n + 1)
log ( n + 1)
( )
O 2 k Restructuring
work
Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità
11. An efficient application
What’s this? Am I
seeing double ?!?
Keeping two SBB(k)-trees
synchronized
Ghosting one tree on
the other one
Hiding rebuilding
work
Presentation by Simone Tino - All rights reserved. Authored from October 2012 to November 2012 - University of Catania - Faculty of Computer Science - Algoritmi e Complessità