CS 178 Homework 5 - Due April 1, 12noon

Ques. 1: Construct a B+-tree for the set of key values (inserted in the sequence shown): (2,10,5,7,17,11,19,30,23,29) assuming that the tree is initially empty and values are inserted in the order shown in the list and the order d of the  B+-tree is (a) 2 and (b) 3.

Show the steps involved in searching for search-key value of 11 for each case above.

Show the steps involved in searching for search-key values between 7 and 17 for each case above.

Ques.2: Suppose we have a file of 10,000 records, each record has 100 bytes. Suppose disk blocks are 512 bytes long. Suppose block addresses are 4 bytes long (i.e., to specify address to a block requires 4 bytes) and also pointers to records are 4 bytes long (i.e., a pointer which specifies address of the record in the block needs 5 bytes).

How many disk I/O operations are needed to sort the above file using (a) 2 input buffers and 1 output buffer and (b) 10 input buffers and 1 output buffer. You must derive the equations in terms of general file size of n records and file of size M disk blocks.

Ques.3: For the file described in question 2, determine the number of disk accesses to do a successul lookup for a record for each of the cases below. Also determine, where possible, the amount of disk space you need to store the index structures or hash structure, or any other structure used in the cases below. Explain your answers.

  1. The file is stored as a heap file.
  2. Hashing is used with 1000 buckets. and the file itself is stored as a heap file in each bucket (not as a sequential file). Is there an improvement (fewer disk accesses) if the file is stored as a sequential file.
  3. Searching when the file is sorted.
  4. Using a one level (clustered) index. Assume that search key field requires 10 bytes.
  5. Secondary/dense indexing using B+-tree structure. Assume tree pointer also requires 4 bytes and search key field requires 10 bytes.

  6.