b+树比B-树好在哪儿

来源:百度知道 编辑:UC知道 时间:2024/06/25 08:35:48
最近实现了B-树,可是书上说,B+树更适合做文件系统的索引,我不太明白,因为B-树和B+树的索引几乎一样,只是B+树必须在叶子节点命中,我感觉这样B+树不是比B-树浪费了很多索引空间么?因为有很多信息明明可以在内结点命中,用B+树的话 内节点得重复建立很多次…… 请专家指教B+树的优势

B+树越大,浪费空间越严重。这点远不如B-树。
并且B+树对任一结点的查找都要走一条从根到叶子结点的路径,效率也不一定就比B-树高

B+树是对B-树的改进,要求所有的信息都在叶子节点上,且,叶子节点都在同一深度,而B-树的叶子节点可以在任意深度。
下面是B+树在维基百科上的定义
B+ tree
From Wikipedia, the free encyclopedia
(Redirected from B plus tree)
Jump to: navigation, search
A simple B+ tree example linking the keys 1-7 to data values d1-d7. Note the linked list (red) allowing rapid in-order traversal.
Enlarge
A simple B+ tree example linking the keys 1-7 to data values d1-d7. Note the linked list (red) allowing rapid in-order traversal.

In computer science, a B+ tree is a type of tree data structure. It represents sorted data in a way that allows for efficient insertion and removal of elements. It is a dynamic, multilevel index with maximum and minimum bounds on the number of keys in each node. The NTFS filesystem for Microsoft Windows and XFS filesystem for Linux use this type of tree.

A B+ tree is a variation on a B-tree. In a B+