Question
Consider a B+ tree in which the search key is 12 bytes long, block size is 1024 bytes, record pointer is 10 bytes long and block pointer is 8 bytes long. The maximum number of keys that can be accommodated in each non-leaf node of the tree is _____.
Official answer and solution
- Official answer
- 50
- From
- Official GATE 2015 answer key
Solution
Formulate the node size inequality for non-leaf B+ tree nodes and solve for the maximum number of keys.
In a B+ tree, a non-leaf (internal) node of order contains:
- block pointers (each pointing to a child node)
- search key values (record pointers are stored only in leaf nodes)
Given sizes:
- Block size
- Search key size
- Block pointer size
The total size of a non-leaf node must not exceed the block size:
Since the order must be an integer, the maximum order is .
The maximum number of search keys accommodated in each non-leaf node is:
50
Including record pointers in non-leaf nodes, which are only present in leaf nodes in a B+ tree.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2015 Computer Science and Information Technology (CS) Session 3
- Question
- 56 of 65, printed as CS Q.46
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.