(a,b)
-trees, i.e.,
trees in the style of B-trees, where each node is required to have at
least a
and at most b
children,
and all leaves are at the same depth.
In the leaves, the "children" are pointers to the actual values
stored. The root is allowed to have as little as 2 children.
a
and
b
) and for insertion an extra element to be
included and for deletion a marked element to be deleted.
Clearly insertion and deletion can create imbalance problems
in the form of nodes with b+1
or a-1
elements.
The operations should be designed to fix such a problem when
possible and otherwise move it closer to the root (where
it has to be possible to fix it).
Notice that for things to work out, it is necessary that
b≥2a-1
.
b=2a-1
, then rebalancing is
Ω(log n)
.
b≥2a
, then rebalancing is
amortized O(1)
.
Use the potential function from red-black trees as inspiration.
One of the two ingredients in that potential function corresponds
to a node with a
children and the other corresponds
to a node with b
children.