简体   繁体   English

B +树中的最大和最小元素

[英]Maximum & minimum elements in a B+ Tree

I am trying to calculate how much would be the maximum and minimum number of elements in a B+ Tree with 4 levels of depth. 我正在尝试计算具有4个深度级别的B +树中元素的最大和最小数量。 (Root + 2 middle and leafs). (根+ 2个中间和叶子)。 when n=75 (it's the order, which means each node has 75 pointers and 74 elements). when n=75 (这是顺序,这意味着每个节点具有75个指针和74个元素)。

The root max amount of elements are n-1 = 74 . 元素的根最大数量为n-1 = 74 And the max amount of the root children are n which means 74 + 74*n . 根孩子的最大数量为n ,即74 + 74*n (Depth 2). (第2层)。 each one of children have also a max of n children which is 74 + 74*n + (n^2)*74 . 每个孩子中也有最多n孩子,即74 + 74*n + (n^2)*74 (Depth 3). (第3层)。

Which means depth 4 with the leafs are (max amount of children): 74 + 74*n + (n^2)*74 + (n^3)*74 ? 这意味着叶子的深度4是(最大子项数): 74 + 74*n + (n^2)*74 + (n^3)*74

Okay so I have the answer, if anyone come across this: 好吧,如果有人遇到这个问题,我就给出了答案:

Max - because the leafs should contain all of the values, the MAXIMUM value is: (n-1)n^3 = 74*(75^3) 最大值-由于叶子应包含所有值,因此最大值为: (n-1)n^3 = 74*(75^3)

Min: the root minimum is 2, and each of the two middle levels pointers minimum is floor() of n/2 and the minimum of elements is (n/2-1). Min:根的最小值为2,两个中间级别的指针的最小值分别为n/2 floor(),元素的最小值为(n / 2-1)。 which means the formula to calculate is 2*(n/2)^2*(n/2-1) = 2*(38^2)*37 这意味着要计算的公式为2*(n/2)^2*(n/2-1) = 2*(38^2)*37

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM