B-tree - B-tree From Wikipedia the free encyclopedia In computer science a B-tree is a tree data structure that keeps data sorted and allows

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
B-tree From Wikipedia, the free encyclopedia In computer science, a B-tree is a tree data structure that keeps data sorted and allows searches, insertions, and deletions in logarithmic amortized time. It is most commonly used in databases and filesystems. In B-trees, internal (non-leaf) nodes can have a variable number of child nodes within some pre-defined range. When data is inserted or removed from a node, its number of child nodes changes. In order to maintain the pre-defined range, internal nodes may be joined or split. Because a range of child nodes is permitted, B-trees do not need re-balancing as frequently as other self-balancing search trees, but may waste some space, since nodes are not entirely full. The lower and upper bounds on the number of child nodes are typically fixed for a particular implementation. For example, in a 2-3 B-tree (often simply referred to as a 2-3 tree ), each internal node may have only 2 or 3 child nodes. A B-tree is kept balanced by requiring that all external nodes are at the same depth. This depth will increase slowly as elements are added to the tree, but an increase in the overall depth is nfrequent, and results in all leaf nodes being one more node further removed from the root. B-trees have substantial advantages over alternative implementations when node access times far exceed access times within nodes. This usually occurs when most nodes are in secondary storage such as hard drives. By maximizing the number of child nodes within each internal node, the height of the tree decreases, balancing occurs less often, and efficiency increases. Usually this value is set such that each node takes up a full disk block or an analogous size in secondary storage. While 2-3 B-trees might be useful in main memory, and are certainly easier to explain, if the node sizes are tuned to the size of a disk block, the result might be a 257-513 B-tree. A B-tree of order m (the maximum number of children for each node) is a tree which satisfies the following properties : 1. Every node has at most m children. 2. Every node (except root and leaves) has at least m/2 children. 3. The root has at least 2 children if it is not a leaf node. 4. All leaves appear in the same level, and carry no information. 5. A non-leaf node with k children contains k – 1 keys The B-tree's creators, Rudolf Bayer and Ed McCreight, have not explained what, if anything, the B stands for. The most common belief is that B stands for balanced , as all the leaf nodes are at the same level in the tree. B may also stand for Bayer , Branching Tree, or for Boeing, because they were working for Boeing Scientific Research Labs at the time. Contents ± 1 Node structures A simple B tree example.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Node structures Each internal node's elements act as separation values which divide its subtrees. For example, if an internal node has three child nodes (or subtrees) then it must have two separation values or elements a 1 and a 2 . All values in the leftmost subtree will be less than
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/20/2010 for the course CS CS206 taught by Professor Lee during the Fall '09 term at 카이스트, 한국과학기술원.

Page1 / 8

B-tree - B-tree From Wikipedia the free encyclopedia In computer science a B-tree is a tree data structure that keeps data sorted and allows

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online