帮助做 Btree 作业
我需要对 B 树进行前序遍历,除此之外,还为每个页面(与节点相同)打印以下信息:
- B 树页号
- 每个 B 树页面指针的值(例如,地址、字节偏移、RRN)。
我的问题是: 1. 如何计算出字节偏移量?它是从什么偏移的? 2、RRN不是和页码一样吗?
注意:Btree 不是二叉树。 Btree 的每个节点可以有多个键,具有 n 个键的节点有 n+1 个子指针。
I need to do a preorder traversal of a Btree, and among other things, print the following information for each page (which is the same thing as a node):
- The B-Tree page number
- The value of each B-Tree page pointer (e.g., address, byte offset, RRN).
My questions are:
1. How do you figure out the byte offset? What is it offset from?
2. Isn't the RRN the same as the page number?
Note: A Btree is NOT A BINARY TREE. Btrees can have multiple keys in each node, and a node with n keys has n+1 child pointers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
字节偏移量可能是记录距页开头的偏移量。
我认为RRN是相对记录号。因此,如果一条记录是页面中的第 5 条记录,则其 RRN 将为 5。
您需要了解页面布局才能知道如何解释页面/节点中的信息。许多解决方案都是可能的。
你必须写什么代码,又给你什么代码?我需要更多地了解作业要求您做什么,然后才能提供更多帮助。
The byte offset is probably the offset of the record from the beginning of the page.
I think the RRN is the relative record number. So if a record is the 5th record in the page, its RRN would be 5.
You need to know the page layout to know how to interpret the information in a page/node. Many solutions are possible.
What code do you have to write, and what code is given to you? I need to know more about exactly what the assignment is asking you to do before I can be of any more help.