B树可以有更多解决方案吗?

时间:2021-07-16 12:04:25

I have this values

我有这个价值观

10,15,20,25,30,33,38,40,43,45,50

and then I insert 34

然后我插入34

I tried 2 generators
https://s3.amazonaws.com/learneroo/visual-algorithms/BTree.html
http://ysangkok.github.io/js-clrs-btree/btree.html and they gave me different results B树可以有更多解决方案吗?B树可以有更多解决方案吗?

我尝试了2台发电机https://s3.amazonaws.com/learneroo/visual-algorithms/BTree.html http://ysangkok.github.io/js-clrs-btree/btree.html他们给了我不同的结果

On paper I tried to create the tree inserting those consecutive values 1 by1 and get a totally different result.

在纸上,我试图创建插入那些连续值1 by1的树,并获得完全不同的结果。

If the elements were in random order would the result be the same?

如果元素是随机顺序,结果是否相同?

My result is this B树可以有更多解决方案吗?

我的结果就是这个

The problem is when on the right I have 38|40|45 and I add 50 I have to put 40 a level higher but in the internet generators they also put 33 a level down and I don't see why

问题是在右边我有38 | 40 | 45并且我加50我必须把40级更高但是在互联网发电机他们也把33级降低了我不明白为什么

1 个解决方案

#1


3  

Can a B tree have more solutions?

B树可以有更多解决方案吗?

I think you're asking whether there can be more than one one way to store a given set of keys in a b-tree, but you have already answered that yourself. Both of the generated examples you present contain the same keys and are valid 1-3 b-trees. The first is also a valid 1-2 b-tree. With the correction, your attempt is also a valid 1-3 b-tree.

我想你在询问是否可以有多种方法将一组给定的密钥存储在一个b树中,但你已经自己回答过了。您提供的两个生成的示例都包含相同的密钥,并且是有效的1-3个b树。第一个也是有效的1-2 b树。通过更正,您的尝试也是一个有效的1-3 b树。

Note well that there are different flavors of b-tree, based on how many keys the internal nodes are permitted to contain, and also that even binary trees, with which you may be more familiar, afford many different structures for the same set of two or more keys.

请注意,根据允许内部节点包含的密钥数量,b-tree有不同的风格,而且即使是您可能更熟悉的二叉树,也可以为同一组的两个树提供许多不同的结构。或更多的钥匙。

If the elements were in random order would the result be the same?

如果元素是随机顺序,结果是否相同?

Very likely so, yes, but that's not a question of the b-tree form and structure, but rather about the implementation of the software used to construct and maintain it.

很可能是这样,是的,但这不是b树形式和结构的问题,而是关于用于构建和维护它的软件的实现。

You seem confused that

你似乎很困惑

in the internet generators they also put 33 a level down and I don't see why

在互联网发电机中他们也降低了33级,我不明白为什么

, but we can only speculate about the implementation of the software supporting those trees. It's unlikely that anyone here can tell you with certainty why they produce the particular b-tree forms they do, but those forms are valid, and so, now, is yours.

,但我们只能推测支持这些树的软件的实现。这里的任何人都不可能确切地告诉你他们为什么会生成他们所做的特定b树形式,但这些形式是有效的,所以,现在,是你的。

#1


3  

Can a B tree have more solutions?

B树可以有更多解决方案吗?

I think you're asking whether there can be more than one one way to store a given set of keys in a b-tree, but you have already answered that yourself. Both of the generated examples you present contain the same keys and are valid 1-3 b-trees. The first is also a valid 1-2 b-tree. With the correction, your attempt is also a valid 1-3 b-tree.

我想你在询问是否可以有多种方法将一组给定的密钥存储在一个b树中,但你已经自己回答过了。您提供的两个生成的示例都包含相同的密钥,并且是有效的1-3个b树。第一个也是有效的1-2 b树。通过更正,您的尝试也是一个有效的1-3 b树。

Note well that there are different flavors of b-tree, based on how many keys the internal nodes are permitted to contain, and also that even binary trees, with which you may be more familiar, afford many different structures for the same set of two or more keys.

请注意,根据允许内部节点包含的密钥数量,b-tree有不同的风格,而且即使是您可能更熟悉的二叉树,也可以为同一组的两个树提供许多不同的结构。或更多的钥匙。

If the elements were in random order would the result be the same?

如果元素是随机顺序,结果是否相同?

Very likely so, yes, but that's not a question of the b-tree form and structure, but rather about the implementation of the software used to construct and maintain it.

很可能是这样,是的,但这不是b树形式和结构的问题,而是关于用于构建和维护它的软件的实现。

You seem confused that

你似乎很困惑

in the internet generators they also put 33 a level down and I don't see why

在互联网发电机中他们也降低了33级,我不明白为什么

, but we can only speculate about the implementation of the software supporting those trees. It's unlikely that anyone here can tell you with certainty why they produce the particular b-tree forms they do, but those forms are valid, and so, now, is yours.

,但我们只能推测支持这些树的软件的实现。这里的任何人都不可能确切地告诉你他们为什么会生成他们所做的特定b树形式,但这些形式是有效的,所以,现在,是你的。