B 树和 2-3-4 树之间的区别

发布于 2024-08-27 10:40:38 字数 53 浏览 7 评论 0原文

B 树和 2-3-4 树有什么区别?

另外,你如何找到每个的最大和最小高度?

What is the difference between B-Trees and 2-3-4 Trees?

Also, how would you find the maximum and minimum height of each?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

眼泪也成诗 2024-09-03 10:40:38

...Wikipedia 的链接和引用:

“2-3-4 树是 4 阶 B 树。”

A 2-3-4 是一个 B-树
它被称为 2-3-4 树,因为非叶、非根节点的子节点数量为 2,3 或 4。
如果是 6,则可以称为 3-4-5-6 树,或简称 3-6 树。
由于子节点的最小数量是最大子节点数量的一半,因此通常可以跳过前者并讨论 m 阶的 B 树。
B 树的阶数定义为节点可以拥有的子节点的最大数量。
在 2-3-4 树中,正如我们所见,最大值为 4。

最坏和最好情况的高度由 B 树的一般公式

最佳情况:logmn。 (所有节点已满)
最坏情况:logm/2n。 (所有节点都是半空的)

其中

  • m 是树的顺序 - 节点可以拥有的子节点的最大数量,在本例中为 4 - 和
  • >n 是树中的条目数

“B 树可以有任意数字的顺序” - 是的,但是对于 B 树的特定子类,您可以在以下位置修复该数字:进步。这就像谈论一般蝴蝶与谈论帝王蝶。 B 树是一类数据结构,就像蝴蝶是一类昆虫一样。 帝王蝶是蝴蝶的子类,就像2-3-4树是B的子类一样-树木。

...a link to Wikipedia and a quote:

"2-3-4 trees are B-trees of order 4."

A 2-3-4 is a B-tree.
It is called 2-3-4 tree because the number of children for a non-leaf, non-root node is 2,3 or 4.
Had it been 6, it could have been called a 3-4-5-6 tree, or 3-6 tree for short.
Since the minimum number of children is half of the maximum, one can just usually skip the former and talk about a B-tree of order m.
The order of a B-tree is defined as the maximum number of children a node can have.
In a 2-3-4 tree, as we have seen, the maximum is 4.

It's worst and best-case height is given by the general formula for B-trees.

Best case: logmn. (all nodes are full)
Worst case: logm/2n. (all nodes are half-empty)

where

  • m is the order of the tree - the maximum number of children a node can have, in this case, 4 - and
  • n is the number of entries in the tree

"B tree can have an order of any number " - yes, but for a particular subclass of B-trees, you fix that number in advance. It's like talking about butterflies in general vs talking about the Monarch butterfly. B-trees are a class of data structures, just like butterflies are a class of insects. Monarch butterflies are a subclass of butterflies, just like 2-3-4 trees are a subclass of B-trees.

幽梦紫曦~ 2024-09-03 10:40:38

b-tree 存在的主要区别是插入时所需的节点分裂次数少于 2-4 树。在 2-4 树中,我们有时会发现一个称为级联分裂的术语,但在 b 树中不存在级联分裂。

the main difference why b-tree comes into existence is the number of node splitting required in time of insertion is less than 2-4 tree. In 2-4 tree we found sometimes a term called cascade splitting but in b-tree there is no cascade splitting present.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文