• edited by
23,851 views
69 69 votes

With reference to the $B^+$ tree index of order $1$ shown below, the minimum number of nodes (including the Root node) that must be fetched in order to satisfy the following query. "Get all records with a search key greater than or equal to $7$ and less than $15$ " is ______.

4 Answers

Best answer
106 106 votes

whichever way you go from the root to leaves, you'll always end up counting $5$ nodes.

• edited by
22 22 votes
The total number of nodes accessed including root will be 5.

The order is,

(9)-->(5)-->(5,7)-->(9,11)-->(13,15).
9 9 votes

The question wants us to perform a range query from 7 to 14 (both inclusive) on a $B^+ \ tree$

This requires for us to first reach the leaf node that has 7, and then traverse in a forward direction until we reach 14. Or vice versa.

This works because:-

  1. ALL the keys can be found in the leafs of a $B^+ \ tree$ — which are interconnected.
  2. Keys are arranged in sorted order. Hence, just finding one end of the range is enough.

 

So, we need 3 accesses (counting root) to reach the leaf that has one end of the range. Then 2 more accesses to reach the other end.

So, 5


Refer to the pictures in sir's answer for clarity.

• edited by
0 0 votes
we are given with a B+ tree in which the key and data pointers are present along with a single block pointer at each leaf node.

we need to get some records,

we can start from left or start from right.

if start from left, 5 nodes need to be fetched similar for the right as well.

as it is bidirectionally, normally it isn't

so answer 5.
Answer:
Position:
Show:

Related questions

99 99 votes
12 answers 12 answers
27.1k
27.1k views
go_editor asked Feb 12, 2015
27,072 views
A Young tableau is a $2D$ array of integers increasing from left to right and from top to bottom. Any unfilled entries are marked with $\infty$, and hence there cannot be...
96 96 votes
8 answers 8 answers
39.1k
39.1k views
go_editor asked Feb 13, 2015
39,117 views
Consider a simple checkpointing protocol and the following set of operations in the log.(start, T4); (write, T4, y, 2, 3); (start, T1); (commit, T4); (write, T1, z, 5, 7)...
47 47 votes
2 answers 2 answers
16.3k
16.3k views
go_editor asked Feb 12, 2015
16,297 views
Consider two relations $R_1(A,B)$ with the tuples $(1,5), (3,7)$ and $R_2(A,C) = (1,7),(4,9)$.Assume that $R(A,B,C)$ is the full natural outer join of $R_1$ and $R_2$. Co...
54 54 votes
5 answers 5 answers
13.7k
13.7k views
go_editor asked Feb 13, 2015
13,669 views
Let $X$ and $Y$ denote the sets containing $2$ and $20$ distinct objects respectively and $F$ denote the set of all possible functions defined from $X$ to $Y$. Let $f$ be...