Advanced search trees Flashcards
M-ary tree
A binary search tree expansion where each node has up to m children, and m-1 keys.
M-ary tree height
If all the nodes are full, then the tree’s height is O(logm(n)). (m-degree of the tree, n-number of different nodes)
B-tree
- An m-ary tree
- Each non root, non leaf node has at least m/2 children.
- All leafs are at the same level.
B-tree insertion (idea)
Insert in a similar fashion to a BST. If the node is full, divide it into two, and send the median up. if it is also full do the same recursively.
B-tree deletion from leaf (idea)
If the node still has a least (m/2 - 1) -> done.
Else -> Try taking from a sibling node.
Not possible -> Merge with sibling node.
B-tree deletion from non leaf node (idea)
Find the successor found in the leaf and replace it.
B-tree run time costs
All actions done in O(logn)
2-3 trees
B trees where the degree m=3