B-Tree - B-tree From Wikipedia, the free encyclopedia Not...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: B-tree From Wikipedia, the free encyclopedia Not to be confused with Binary tree . A B-tree of order 2 ( Bayer & McCreight 1972 ) or order 5 ( Knuth 1997 ). In computer science , a B-tree is a tree data structure that keeps data sorted and allows searches, sequential access, insertions, and deletions in logarithmic amortized time . The B-tree is a generalization of a binary search tree in that more than two paths diverge from a single node. ( Comer , p. 123) Unlike self-balancing binary search trees , the B-tree is optimized for systems that read and write large blocks of data. It is commonly used in databases and filesystems . Contents [ hide ] • 1 Overview o 1.1 Variants o 1.2 Etymology unknown • 2 The database problem o 2.1 Time to search a sorted file o 2.2 An index speeds the search o 2.3 Insertions and deletions cause trouble o 2.4 The B-tree uses all those ideas • 3 Technical description o 3.1 Terminology o 3.2 Definition • 4 Best case and worst case heights • 5 Algorithms o 5.1 Search o 5.2 Insertion o 5.3 Deletion 5.3.1 Deletion from a leaf node 5.3.2 Deletion from an internal node 5.3.3 Rebalancing after deletion o 5.4 Initial construction • 6 B-trees in filesystems • 7 Notes o 7.1 Access concurrency • 8 See also • 9 References o 9.1 Original papers • 10 External links [ edit ] Overview 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. Each internal node of a B-tree will contain a number of keys. Usually, the number of keys is chosen to vary between d and 2 d . In practice, the keys take up the most space in a node. The factor of 2 will guarantee that nodes can be split or combined. If an internal node has 2 d keys, then adding a key to that node can be accomplished by splitting the 2 d key node into two d key nodes and adding the key to the parent node. Each split node has the required minimum number of keys. Similarly, if an internal node and its neighbor each have d keys, then a key may be deleted from the internal node by combining with its neighbor. Deleting the key would make the internal node have d − 1 keys; joining the neighbor would add d keys plus one more key brought down from the neighbor's parent. The result is an entirely full node of 2 d keys. The number of branches (or child nodes) from a node will be one more than the number of keys stored in the node. In a 2-3 B-tree, the internal nodes will store either one key (with two child nodes) or two keys the node....
View Full Document

This note was uploaded on 10/31/2010 for the course EE 423 taught by Professor Mitin during the Spring '10 term at SUNY Buffalo.

Page1 / 16

B-Tree - B-tree From Wikipedia, the free encyclopedia Not...

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

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