written 2.8 years ago by | modified 2.8 years ago by |
Suppose a key value is 9 bytes, pointer is 7 bytes and page size is 512 bytes. How many key values you can enter in a leaf and non-leaf node of a B+ tree?
written 2.8 years ago by | modified 2.8 years ago by |
Suppose a key value is 9 bytes, pointer is 7 bytes and page size is 512 bytes. How many key values you can enter in a leaf and non-leaf node of a B+ tree?
written 2.8 years ago by | • modified 2.8 years ago |
Given data for B+ Tree -
Page Size of Data = D = 512 byte
Pointer = B = 7 byte
Key Valye = K = 9 byte
To find -
How many key values you can enter in a leaf and non-leaf node of a B+ tree = ?
Formula -
$$p * B + (p - 1)*K \le D$$
Where,
p represents the order of an internal node in a B+ tree index that is the maximum number of children or leaf & non-leaf nodes it can have.
Solution -
$$p * B + (p - 1)*K \le D$$
$$p * 7 + (p - 1)*9 \le 512$$
$$7p + 9p - 9 \le 512$$
$$7p + 9p \le 521$$
$$16p \le 521$$
$$p \le 32.56$$
$$p = 32$$
Therefore,
Total 32 key values can be entered in a leaf and non-leaf node of a B+ tree.