edited by
7,430 views
16 votes
16 votes

Given a block can hold either $3$ records or $10$ key pointers. A database contains n records, then how many blocks do we need to hold the data file and the dense index

  1. $13n/30$
  2. $n/3$
  3. $n/10$
  4. $n/30$
edited by

3 Answers

Best answer
20 votes
20 votes
total number of block required by data file = n/3

total number of records needed by pointer = n/10. ( key pointer = no of keys)

total blocks = n/3+n/10 =13n / 30
10 votes
10 votes

This is a question on simple indexing and so we should not bother about higher level of indexing..

So no of records given  =  n

 no of records per data block given = 3

So no of data blocks    =  n / 3

Now we know in dense index ,

No of <key,pointer> pairs in dense index = No of data records 

So

No of <key,pointer> pairs in 1st level index here = n

So no of  index blocks  = n/10 [ As there are 10 such pairs per index block]

So total no of data blocks and index blocks required  =  n / 3 + n / 10

                                                                             =  13 n / 30

Hence A) should be the correct answer..

2 votes
2 votes

For $n$ records, blocks required = $\frac{n}{3}$

For $n$ indices in the index file, blocks required = $\frac{n}{10}$

Total = $\frac{n}{3}+\frac{n}{10}$ = $\frac{10n}{30}+\frac{3n}{30}$ = $\frac{13n}{30}$

Option A


Bonus:-

In case of sparse indexing:

For $n$ records, blocks required = $\frac{n}{3}$

For $\frac{n}{3}$ indices in the index file, blockes required = $\frac{n}{30}$

Total = $\frac{n}{3}+\frac{n}{30}$ = $\frac{10n}{30}+\frac{n}{30}$ = $\frac{11n}{30}$


For dense indexing, we have a pointer (index in the index file) for each record.

For sparse indexing, we have a pointer for each block. (More specifically for every first record of the block)

Answer:

Related questions

7 votes
7 votes
3 answers
1
go_editor asked Jun 19, 2016
3,769 views
If a node has $K$ children in $B$ tree, then the node contains exactly _____ keys.$K^2$$K-1$$K+1$$\sqrt{K}$
8 votes
8 votes
2 answers
4