B-trees Flashcards
Describe the four properties for an m-way b-tree (a b-tree of order m).
1) All leaves are on the same level.
2) All internal nodes except the root have at most m non empty children and at least
ceil (m / 2 ) nom empty children.
3) The number of keys in each internal node is equal to 1 less the number of its
nonempty children.
4) The root has at most m children.
Describe inserting an element into the b-tree.
1) Search for a position in the b-tree where the new element would fit.
2) Try inserting it.
3) Observe which of the properties the insertion violates.
4) Fix the problems.
The problems can usually be fixed by splitting the current node into three nodes (Left, right and middle), and propagating the middle element upwards. This might mean the children of this node need be split and moved either to the resulting left/right subtrees independent of each other.
Describe deleting an element from a b-tree.
1) Try deleting the element.
2) Observe which properties the deletion violates.
3) Observe what we can change to make up for the problem.
4) Implement those changes.
A deletion can usually be