Find three multipath Find tree (2-3 tree, 2-3-4 tree, B-tree, + + tree)

Source: Internet
Author: User

Scenario: Resolve a lookup in a large amount of data on the hard disk. Because a large amount of data is stored in the hard disk, can not be loaded into memory all at once, and each time a data read the hard disk, reading speed is too slow, it is necessary to use a part of a data structure read in, this is the role of multi-path search tree. 2-3 Trees

2 nodes: Each of the points contains one element and two children (or no children). Where the left child is less than the node element, the right child is larger than the node element.
3 nodes: Each node consists of two elements and three children (or no children). Where the left child is less than the smaller element in the node, the child is larger than the smaller element, and the right child is larger than the larger element.
2-3 Tree: A tree consisting of 2 nodes and 3 nodes, and all leaf nodes are 2-3-4 on the same layer

2-3 the expansion of the tree, added 4 nodes, containing a small medium-large three elements and four children spread over three spatial ranges divided by these four elements. B-Tree

B-Tree is similar to 2-3 tree and 2-3-4 tree, the maximum number of children is called the Order of B-tree, each node of B-Tree is more than the original node that indicates the number of elements of the storage space. The Order of the general B-tree is very large.
Advantages: Easy to find, each node is stored in the corresponding hard disk page, each time read a node and key value comparison, and then determine the next time to read which node.
Cons: When you need to do a mid-order traversal, we need to go back and forth between each node (that is, the middle sequence traverses the left child to the parent node and then to the left child to the right), which causes multiple hard drive accesses and slows down. That's the need to use B + Tree B + Tree

Solve the basic problem of element traversal.
B + Tree: Breaks the principle that each element of a tree species appears only once, adding elements from other intermediate nodes on each leaf node. That is, the leaf contains all the original node information, and contains the index of the successor leaf node.

Pros: Especially suitable for a range of lookups.

The database uses a B + tree lookup.

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.