This preview shows pages 1–4. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Btree From Wikipedia, the free encyclopedia Not to be confused with Binary tree . A Btree of order 2 ( Bayer & McCreight 1972 ) or order 5 ( Knuth 1997 ). In computer science , a Btree is a tree data structure that keeps data sorted and allows searches, sequential access, insertions, and deletions in logarithmic amortized time . The Btree is a generalization of a binary search tree in that more than two paths diverge from a single node. ( Comer , p. 123) Unlike selfbalancing binary search trees , the Btree 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 Btree 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 Btrees 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 Btrees internal (nonleaf) nodes can have a variable number of child nodes within some predefined range. When data is inserted or removed from a node, its number of child nodes changes. In order to maintain the predefined range, internal nodes may be joined or split. Because a range of child nodes is permitted, Btrees do not need rebalancing as frequently as other selfbalancing 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 23 Btree (often simply referred to as a 23 tree ), each internal node may have only 2 or 3 child nodes. Each internal node of a Btree 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 23 Btree, 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.
 Spring '10
 MITIN

Click to edit the document details