Difference in calculating the order for B-Tree and B+-Tree?

强颜欢笑 提交于 2019-12-25 01:44:53

问题


I got this simple question

Calculate the order p of a B+ tree if B=512, V=9B, Pr=7B and P=6B.

I think the answer is

6p + (p - 1) * 9 < 512

which ignore the Pr

but if change the question is to calculate order p of a B-Tree with same values for B,Pr, P and B then, I think the answer should be

6p + (p - 1) * (9 + 78) < 512

Am I correct on this?


回答1:


Each B Tree node can have at most p tree pointers, and p-1 data pointers and p-1 search key fields values. These must fit into a single disk block if the required B-Tree node must correspond to a disk block.

To calculate p:

6p+(p-1)*(9 + 7) <= 512
6p + 9p + 7p -9 – 7 <= 512
22p – 16 <= 512
22p <= 528
p <= 24

Although p can be a maximum of 24, we choose p = 23 because the B Tree nodes may contain additional information used to manipulate the tree, such as the number of entries q in the node, and a pointer to the parent, therefore before we calculate p above, the block size should be first reduced by the amount of extra space needed.



来源:https://stackoverflow.com/questions/19748506/difference-in-calculating-the-order-for-b-tree-and-b-tree

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!