Please enable JavaScript.
Coggle requires JavaScript to display documents.
MM8 - Coggle Diagram
MM8
transform and conquer
BALANCED SEARCH TREES
structures that preserves the good proprieties of the binary search tree but avoids the worst-case efficiency
instance-simplification
-
- AVL Trees
- Red-Black Trees
- Splay Trees
-
representation-chance
-
-
- 2-3 Trees
- 2-3-4 Trees
- B-trees
AVL trees
balance factor: difference between the heights of the left and right subtrees of a node is either 0, +1 or -1
The height of an empty tree is defined as -1
rotation: transformation on a subtree rooted at a node with balance +2 or -2 after an insertion
If there are more than one node than one node like that, the transformation is made on the one closest to the inserted leaf
-
efficiency
like the binary search tree, it depends on the height
-
-
-
-
-
2-3 trees
-
3-node
-
three children
- left < K1
- K1 < middle < K2
- right > K2
-
-
inserting
-
-
-
if the leaf is a 3-node:
split the leaf in two (the smallest element on the left, the larger on the right)
the middle element is "promoted" to the parent
efficiency
-
a tree with the smallest number of keys is all 2-noded:
n >= 1 + 2 + 3 + ... + 2^h = 2^(h+1) -1
h <= log_2(n+1) - 1
a tree with the largest number of keys is all 3-noded:
n <= 2.1 + 2.3 + 2.9 + ... + 2.3^h = 2(1 + 3 + 9 + ... + 3^h) = 3^(h+1) - 1
h >= log_3(n+1) - 1
-
searching, inserting and deleting of the worst and avarage case:
theta(log(n))