Briefly remember the difference between B+ tree and B- tree

As for the difference between B+ tree and B-tree, the explanations on the Internet are very general. Most of them copy the concept again. I can’t help but complain. If I come to see the concept, I can’t just turn the book, and I need you. To earn traffic?
The concept of B+ and B-tree is very obscure for a newcomer like me, but it still has to be clear. Closer to home.
I briefly sorted out three differences.

  1. The node of the B-tree is derived from the left or right of a keyword in the parent node, or between two keywords, which means that all keywords in the derived node are greater than (less than) in the parent node The previous (last 1) keyword. The nodes of the B+ tree are derived from a certain keyword of the parent node. How many child nodes can be derived if the parent node has several keywords. Each keyword in the parent node is the maximum value among the child nodes derived from the keyword. This is the most important difference . If you understand this point, it will be easy to understand later.
  2. The B-tree stipulates that a node has at least m/2 (rounded up) keywords, that is, at least m/2 (rounded up) child nodes. There must be at most m-1 keywords, that is, at most m child nodes. In the B+ tree, at most one node has m keywords, that is, there are m child nodes, and at least m/2 keywords, that is, m/2 child nodes. The difference between B+ and B-, in the final analysis, still has to understand the difference between the first point.
  3. The B-tree root node has either no subtree or a key, that is, it has at least 2 child nodes. The root node of the B+ tree has either no subtree or at least two keywords, namely 2 child nodes. This difference also stems from the first difference.
  4. I will not enumerate them one by one in the follow-up. For example, the external nodes of the B+ tree can be searched in order. After understanding the first feature, it will be overwhelming.

Finally, good luck.

Guess you like

Origin blog.csdn.net/baidu_31788709/article/details/111027161