edited by
13,553 views
44 votes
44 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 ______.

edited by

3 Answers

Best answer
69 votes
69 votes

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

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

The order is,

(9)-->(5)-->(5,7)-->(9,11)-->(13,15).
4 votes
4 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
Answer:

Related questions

13.6k
views
9 answers
73 votes
go_editor asked Feb 12, 2015
13,575 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...
21.7k
views
4 answers
51 votes
go_editor asked Feb 15, 2015
21,701 views
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 poin...
25.9k
views
5 answers
57 votes
go_editor asked Feb 13, 2015
25,862 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)...
9.2k
views
2 answers
31 votes
go_editor asked Feb 12, 2015
9,249 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...