edited by
32,789 views
76 76 votes
Consider a $B^+$ tree in which the search key is $12$ $\text{bytes}$ long, block size is $1024$ $\text{bytes}$, record pointer is $10$ $\text{bytes}$ long and the block pointer is $8$ $\text{bytes}$ long. The maximum number of keys that can be accommodated in each non-leaf node of the tree is ______.

5 Answers

Best answer
106 106 votes
In a B+ tree of order $n$, for a non-leaf node we can have up to $(n-1)$ keys and $n$ child pointers (pointing to child blocks).

$\therefore (n-1)12 + n\times 8\leq 1024$

$\implies n\leq 51$

Number of keys $= n-1$

$= 51-1=50$
edited by
16 16 votes

 this is the correct way to solve

here for non leaf node order is max no of keys/node

means max keys/node=p and (Bp)block_ptr/node=p+1

(p+1)(Bp size)+p(key size)<=block size

(p+1)(8)+p(12)<=1024

20p<=1016

p<=50.8

p=50

2 2 votes
Maximum keys =50 (answer)

because keys are always 1 less than block pointer in non-leaf node. Here record pointer is given just for confusion as record pointer dont even exist in non-leaf. Only leaf node contains record pointer.
1 1 vote
P (BLOCK POINTER) + (P-1) SEARCH KEY

P8+(P-1)12 <=1024

P8+12P-12<=1024

P8+12P<=1024+12

20P<=1036

P=51.8

P=51

AND DUE TO NON LEAF (P-1)

51-1=50 SO 50 WILL BE CORRECT ONE

#Cross_check

20*51.8=1024 and given block size is 1024 it is correct

why we dont take 52 even if it is mention in the option just because if we put in the equation 1040-12=1028 and 1028 is greater than BLOCK SIZE ..
edited by
0 0 votes
Search key size = 12B

Block Size = 1024B

Block Pointer = 8B

Record Pointer = 10B (not required to solve this question)

Wrt Internal node if order is y then

Maximum keys possible are y-1

Maximum block pointer possible= y

There is no record pointer in internal node

So,

y(8)+(y-1)(12)<=1024

y<=51.9

y=51

So y-1= 50 is maximum number of keys possible

ANSWER 50
Answer:
Position:
Show:

Related questions

92 92 votes
7 answers 7 answers
26.5k
26.5k views
go_editor asked Feb 15, 2015
26,525 views
Consider the partial Schedule $S$ involving two transactions $T1$ and $T2$. Only the $\textit{read}$ and the $\textit{write}$ operations have been shown. The $\textit{rea...
59 59 votes
4 answers 4 answers
20.0k
20.0k views
go_editor asked Feb 14, 2015
20,035 views
Consider the following relationCinema($\textit{theater, address, capacity}$)Which of the following options will be needed at the end of the SQL querySELECT P1.address FRO...
67 67 votes
5 answers 5 answers
20.4k
20.4k views
go_editor asked Feb 16, 2015
20,435 views
Consider the following C program:#include<stdio.h int f1(void); int f2(void); int f3(void); int x=10; int main() { int x=1; x += f1() + f2 () + f3() + f2(); printf("%d", ...
12 12 votes
3 3 answers
10.9k
10.9k views
go_editor asked Feb 16, 2015
10,902 views
The velocity $v$ (in kilometer/minute) of a motorbike which starts form rest, is given at fixed intervals of time $t$ (in minutes) as follows:t2468101214161820v1018252932...