retagged by
1,374 views
4 votes
4 votes
A file has $2^{29}$ records each of size 8B. One block of main memory is $128B$.  Sparse indexing is done with one index record per memory block and one index record is of $1$ $Byte$. The blocks stored by the index records are stored in disk. Blocks occupied by index are searched using binary search technique. Maximum number of blocks need to be read is _____.
retagged by

1 Answer

Best answer
12 votes
12 votes

Total records = 2^29,   One record = 8B,    Number of records/block = l28 B/8 B = 16
 
Number of block =  2^29 / 2^4 = 2^25 ,  One index record per block.  So total number of index records = 2^25

One index record = 1B .  Number of index records / block = 128  .  Index occupies = 2^15 / 2^7 =  2^18 blocks

 Binary search requires as many as, [ log2 2^18] blocks to be read = 18

and  1 more for accessing the record so in total 18+1= 19 blocks are needed to read.

Reference ( why need to add extra block )

selected by
Answer:

Related questions

3 votes
3 votes
2 answers
2