B-trees were introduced by Bayer and McCreight in 1972 (they did not explain their choice of name). They are balanced search trees designed to work well on magnetic disks or other direct-access secondary storage devices. B-trees are similar to red-black trees in that every n-node B-tree has height O(lg n), although the height of a B-tree can be considerably less than that of a red-black tree because its branching factor can be much larger. Therefore, B-trees can also be used to implement many dynamic-set operations in time O(lg n).
The standard representation adopted here is a sequence of number of children of each internal node, where the nodes are traversed bottom-up level-by-level and from right-to-left within a level. See the following figure for an example:
This is a B-tree of order 4 and has the encoding 3 2 2 2 3 2 4 2 3 2 3 .
For B-tree of order 3 with n = 1,2,..,17 leaves, the number of trees are: 0, 1, 1, 1, 2, 2, 3, 4, 5, 8, 14, 23, 32, 43, 63, 97, 149. This is sequence Anum=A014535"> A014535(M0564) in
The algorithm used is based on one by Pierre Kelsen and is presented in the book Combinatorial Generation.