[英]B+ tree insertion order
Is there a possible way to find the original insertion order of a B+ tree?有没有办法找到B+树的原始插入顺序?
I have this tree:我有这棵树:
{ [ (1 2) 3 (5 6 7) ] 8 [ (9 10) 11 (12 13) 14 (14 16 17) 18 ( 19 20) ] } { [ (1 2) 3 (5 6 7) ] 8 [ (9 10) 11 (12 13) 14 (14 16 17) 18 ( 19 20) ] }
No.不。
For example in your case, the last two inserts could have been 7, 17
or 17, 7
and there is absolutely no way to tell which was which.例如,在您的情况下,最后两个插入可能是
7, 17
或17, 7
并且绝对无法分辨哪个是哪个。 Indeed of 5, 6, 7
one of the three was inserted after the other two and there is no record of which is which.确实,
5, 6, 7
三者中的一个是在另外两个之后插入的,没有记录哪个是哪个。
This can also be seen immediately from the pigeon hole principle.这也可以从鸽巢原理中直接看出。 First let's put an upper bound on how many
k
-way B-trees there can be with n
things in it.首先,让我们为可以有多少
k
路 B 树设置一个上限,其中有n
东西。
The structure of any b-tree
with n
things can be encoded as a stream of the sizes of the nodes.任何具有
n
事物的b-tree
的结构都可以编码为节点大小的流。 From the size of the top node, you know what how many second tier nodes there are, ditto for third tier from second tier.从顶层节点的大小,你知道有多少第二层节点,第二层第三层也是如此。 A node can have anywhere from
1..k
things in it.一个节点可以有
1..k
东西。 There cannot be more nodes than elements.节点不能多于元素。 Therefore we can specify a B-tree by first specifying how many nodes there are, then the sizes of the nodes.
因此,我们可以通过首先指定有多少个节点,然后指定节点的大小来指定 B 树。 (Not all sets of numbers will be a B-tree.) For every size
s
of B-tree, there are k^s <= k^n
of them. (并非所有数字集都是 B 树。)对于 B 树的每个大小
s
,都有k^s <= k^n
个。 Therefore nk^n
is an upper bound on how many k
-way B-trees there can be.因此
nk^n
是可以有多少k
路 B 树的上限。 Which is exponential growth.这是指数增长。
But the number of orders in which elements might be inserted is n!
但是可以插入元素的顺序数是
n!
. . This function grows strictly faster than exponential growth, and so you cannot recover the order from the B-tree.
此函数的增长速度严格快于指数增长,因此您无法从 B 树中恢复顺序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.