0

Suppose we have a B+tree32, and we insert keys in it in a monotonically increasing order. Within just the root node, 31 keys will fit.

When inserting the 32nd key, the root node will split, resulting in two nodes with 16 keys each. If we continue to add keys in the increasing order, the "left" nodes after every split will forever remain half-full. Therefore, the third level will have to be formed when a key is inserted into the tree when there are 31 nodes of 16 keys each, and one node of 31 keys, as opposed to a completely filled tree with 32 nodes of 31 keys each.

For two levels of nodes, it is quite straightforward to construct a sequence of key values to make all 32 second-level nodes contain exactly 31 keys before the third level is formed, but for a greater number of levels it does not appear so.

Is there a known algorithm to form key sequences to achieve a completely filled tree with a given number of levels?

Leo B.
  • 133
  • 5

0 Answers0