CS 377 - Database Systems

Hw7: B+-tree and External Merge Sort

Out: Thursday, November 3

Due: Thursday, November 10, 11:59pm



1)    Given a B+-tree below of order p=4 and pleaf =3 (p is the maximum number of pointers or children at each node;  pleaf = p -1 is the maximum number of pointers at each leaf node that point to a data record).  Consider a series of search field values are deleted from the tree in this order: 18, 20, 92, 59.  Assume the deletion algorithm merges a node with the right (next) leaf node when it can be merged with either left (previous) or right (next) node.  A tree pointer at an internal node between key value Ki-1 and Ki points to a node with values between Ki-1 and Ki-1 (Ki-1 < X <= Ki).  


a)    What’s the minimum and maximum number of tree pointers at each internal node (except the root node)? What’s the minimum and maximum number of record pointers at each leaf node?

b)    Indicate the deletion values that result in reorganization of the tree.  Show the final tree after the deletions (you don’t have to show intermediate trees).

2)    A file of 4096 blocks is to be sorted with an available buffer space of 64 blocks using the external merge sort algorithm. Calculate:

a)    How many passes will be needed in the merge phase?

b)    How many block accesses (for reading and writing) are needed in total?


·           Please place your solution in your cs377 directory ~/cs377/hw7/hw7.pdf