Summary of several balancing trees and summary of several balancing trees

Source: Internet
Author: User

Summary of several balancing trees and summary of several balancing trees

1. Introduction to 2-3-4 trees
2-3-4 is a multiway tree. Each node has a maximum of four subnodes and three data items, the tree 2-3-4 can be regarded as the B tree with the order of 4. B-tree is another Balanced Multi-Cross-tree that is specially used in external storage to organize data (usually a disk drive ). The number of nodes in Tree B can be several times or several hundred.
2, 3, and 4 in the 2-3-4 tree name indicate the number of subnodes that a node may contain.
A node with one data item always has two subnodes.
Nodes with two data items always have three subnodes.
Nodes with three data items always have four subnodes.
In short, the number of subnodes of a non-leaf node is always 1 more than the data items contained in the node.
A node cannot have only one link in 2-3-4 trees, which is different from a traditional binary tree.
II. B and B +
Binary Tree provides good performance, but it will lose balance when data is inserted in an orderly manner. The two-to-three trees and the two-to-three trees are a Balance Tree, multiple channels, the red-black tree (see the previous article) is a binary balancing tree that maintains a balance through strict red-black rules. B is a balanced multi-path search tree, which can be seen as an extended 2-3-4 tree, there is no limit on the number of data items and the number of subnodes (if the number of elements at a node is very large, it will be degraded into linear searches within the node), which is applied in the file system, it is mainly used as an index for files.
To insert a node to the B-tree, you must note that the node is split from the child node until it is traced to the root node.
B + tree is a variant of B tree
The non-leaf node in the B + tree is not the final node pointing to the file content, but the index of the keyword in the leaf node. All leaf nodes contain information about all the keywords, and the leaf nodes themselves are connected in ascending order based on the keywords. Therefore, any keyword search must follow a path from the root node to the leaf node (resulting in a high query efficiency for each data ).

All in all, while improving the disk I/O performance, B-tree does not solve the problem of low element traversal efficiency. To solve this problem, the B + tree came into being. Tree B + can traverse the entire tree as long as it traverses the leaf node, and supports range-based queries. Tree B does not support operations such as range-query (or efficiency is too low ).

Based on the above introduction, we will summarize the B, B +, and B * trees as follows:
● Tree B: ordered array + balanced multi-Cross Tree;
● B + tree: ordered array linked list + balanced multi-Cross Tree;
● B *: a plump B + tree.
B-tree-related reference http://blog.csdn.net/v_july_v/article/details/6530142

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.