views:

106

answers:

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):

  1. The B-Tree page number
  2. 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.

A: 

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.

Jay
The code for B-tree creation is given, sort of. I need to make a program that traverses the B-tree, and outputs information about it. The program can use the other files that were used in constructing the B-tree. The main point of the program is so that the user can know the characteristics of the Btree.
Phenom
If RRN refers to the keys in the page and not the page itself, then if every page has 5 keys, are the RRN numbers going to always be from 1 to 5, or does every single key in the tree have a unique RRN?
Phenom
I am not 100% sure what an RRN is, but I think it means "relative record number". If this is the case, then if every page have 5 keys, then an RRN will always be an integer from 1 to 5. Another way to explain it is, it uniquely identifies and record on a page. It wouldn't be a bad idea to double check this with someone.If your given the code for the Btree's data structures, then those files should explain how to extract the information from a node.
Jay