B-Tree. B-Trees. a specialized multi-way tree designed especially for use on disk In a B-tree each node may contain a large number of keys. The number of subtrees of each node, then, may also be large
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
B-Tree
1. Every node has at most m children.
2. Every node (except root and leaves) has at least ceil(m⁄2) children.
3. The root has at least two children if it is not a leaf node.
4. All leaves appear in the same level, and carry information.
5. A non-leaf node with k children contains k–1 key
6. Each leaf node (other than the root node if it is a leaf) must contain at least ceil(m / 2) - 1 keys
7. Keys and subtrees are arranged in the fashion of search tree
1. the element in an internal node may be a separator for its child nodes
2. deleting an element may put it under the minimum number of elements and children
Additional changes -- Rebalancing after deletion
* Create a new node with all the elements from the deficient node, all the elements from one of its siblings, and the separator in the parent between the two combined sibling nodes.
* Remove the separator from the parent, and replace the two children it separated with the combined node.
* If that brings the number of elements in the parent under the minimum, repeat these steps with that deficient node, unless it is the root, since the root may be deficient.
Delete H
2-3 B-Trees or simply referred as 2-3 tree
Properties
• trinary tree - 3 or fewer children per node
• each node is either a 2-node or 3-node (subtree count)
• 2-nodes contain 1 value and 3-nodes contain 2 sorted
• BST property holds for node content & left, mid, right subtrees
• all leaves have same level
public class TwoThreeTree<Content> {
private boolean is2node;
private Content smallContent;
private Content bigContent;
private TwoThreeTree<Content> left;
private TwoThreeTree<Content> mid;
private TwoThreeTree<Content> right;
private TwoThreeTree<Content> parent;
...
}
2-3 Tree Implementation
Ways to improve a B-tree
•keep all values in the leaves
•form a linked list of leaf nodes
B+-Tree
How do these modifications change the performance of
...a search?
...an insertion or removal?