2,648 views
1 votes
1 votes
minimum number of nodes (both leaf and non leaf) of B+ tree index required  for storing 5500 keys and order of B+ tree is 8 _________

(order is maximum pointers a node can have)

 

am getting 4681

2 Answers

Best answer
2 votes
2 votes

so we have 5500 keys of database so these 5500 keys need to be stored in the leaves of b+ trees.(as all <k,ptr> pairs are stored in the leaves of B+ tree).

here B+ tree order is 8 so we have 7 key pointer pairs available at each leaf node. As we have to count minimum number of B+tree nodes we will fill leaf nodes and non leaf nodes with maximum capacity as possible.

so for 5500 keys:

1.at lowest level:$\left \lceil 5500/7 \right \rceil$ = 786

{actually here 785 nodes are full and the last one is 71% full which is valid as a nodes at least should have 4 pointers (or 3 <key ptr> pairs in minimum)}

 

2.for 786 nodes now we will need pointers in upper level so  $\left \lceil 786/8\right \rceil$ = 99 nodes.

{here observe that 786/8 is actually 98.25 so we have 98 nodes are full and 99th node is 25% full which is not allowed as it will undergo underflow .so we will distribute keys between 98th node and 99th node so that they both will be valid now}

 

3. for 99 nodes again we need $\left \lceil 99/8\right \rceil$ =13

 

4. for 13 nodes we need $\left \lceil 13/8\right \rceil$ =2

 

5. for the 2 nodes we need 1 node which is root which can have minimum 2 pointers =1

 

so totally we have 786+99+13+3=901 minimum number of nodes

 

selected by
2 votes
2 votes

901 is right.

Related questions

0 votes
0 votes
1 answer
1
jiminpark asked Dec 22, 2021
361 views
3 votes
3 votes
2 answers
2
Ram Swaroop asked Jan 30, 2019
1,299 views
Consider the following relation R(A1, A2,...A15) with (A1,A2, ... A6) of relation R are simple candidate key. The number of possible superkey in relation R is_
0 votes
0 votes
1 answer
4
iita asked Feb 2, 2017
675 views
Which of the following relation can decompose into BCNF with dependency preserving and lossless join decomposition.(i) R(ABCDE) {AB → C, C → AB, C → D, D → E}(ii)...