B Tree
B Tree
Invented 1971
Variants
Technical description
Terminology
Definition
According to Knuth's definition, a B-tree of
order m is a tree which satisfies the
following properties:
Internal nodes
Internal nodes are all nodes except for
leaf nodes and the root node. They are
usually represented as an ordered set of
elements and child pointers. Every
internal node contains a maximum of U
children and a minimum of L children.
Thus, the number of elements is always
1 less than the number of child pointers
(the number of elements is between L−1
and U−1). U must be either 2L or 2L−1;
therefore each internal node is at least
half full. The relationship between U and
L implies that two half-full nodes can be
joined to make a legal node, and one full
node can be split into two legal nodes (if
there’s room to push one element up
into the parent). These properties make
it possible to delete and insert new
values into a B-tree and adjust the tree
to preserve the B-tree properties.
The root node
The root node’s number of children has
the same upper limit as internal nodes,
but has no lower limit. For example,
when there are fewer than L−1 elements
in the entire tree, the root will be the only
node in the tree with no children at all.
Leaf nodes
In Knuth's terminology, leaf nodes do not
carry any information. The internal
nodes that are one level above the
leaves are what would be called "leaves"
by other authors: these nodes only store
keys (at most m-1, and at least m/2-1 if
they are not the root) and pointers to
nodes carrying no information.
Algorithms
This article may be confusing or unclear to
readers. In particular, the discussion below uses
Learn more
Search
Insertion
A B Tree insertion example with each iteration. The
nodes of this B tree have at most 3 children (Knuth
order 3).
Sequential access
Initial construction
In filesystems
In addition to its use in databases, the B-
tree (or § Variants) is also used in
filesystems to allow quick random access
to an arbitrary block in a particular file. The
basic problem is turning the file block
address into a disk block (or perhaps to a
cylinder-head-sector) address.
Variations
Access concurrency
Etymology
Rudolf Bayer and Ed McCreight invented
the B-tree while working at Boeing
Research Labs in 1971 (Bayer & McCreight
1972), but did not explain what, if anything,
the B stands for: Boeing, balanced, broad,
bushy, and Bayer have been suggested.
(Comer 1979, p. 123 footnote 1)[13][14]
McCreight has said that "the more you
think about what the B in B-trees means,
the better you understand B-trees."[13]