You are on page 1of 2

Alexandria University

Faculty of Engineering
Computer and Systems Engineering
Department

Data Structures 2
Due: Monday, 27 April, 2015

Sheet 3
B-Trees
1. As a function of the minimum degree t, what is the maximum number of keys that can
be stored in a B-tree of height h?
2. Why dont we allow a minimum degree of t = 1?
3. For what values of t is the tree of Figure 1 a legal B-tree?

Figure 1: A B-tree whose keys are the consonants of English. An internal node x containing
x.n keys has x.n + 1 children. All leaves are at the same depth in the tree. The lightly shaded
nodes are examined in a search for the letter R.
4. Show the results of inserting the keys
F, S, Q, K, C, L, H, T, V, W, M, R, N, P, A, B, X, Y, D, Z, E

(1)

in order into an empty B-tree with minimum degree 2. Draw only the configurations of
the tree just before some node must split, and also draw the final configuration.
5. Explain how to find the minimum key stored in a B-tree and how to find the predecessor
of a given key stored in a B-tree.
6. Suppose that disk hardware allows us to choose the size of a disk page arbitrarily, but
that the time it takes to read the disk page is a + bt, where a and b are specified constants
and t is the minimum degree for a B-tree using pages of the selected size. Describe how
to choose t so as to minimize (approximately) the B-tree search time. Suggest an optimal
value of t for the case in which a = 5 milliseconds and b = 10 microseconds.
7. Show the results of deleting C, P , and V , in order, from the tree of Figure 2.
1

Alexandria University
Faculty of Engineering
Computer and Systems Engineering
Department

Data Structures 2
Due: Monday, 27 April, 2015

Figure 2: B-Tree Deletion


8. Assume B+ trees of order n = 3 (n is the maximum number of pointers in a node)
(a) Draw a tree of height 2 with the following keys: A, C, D, F (lexicographically
ordered).
(b) Show how the insertion of two new keys, followed by their deletions, could change
this 2-level tree into a 3-level tree with exactly the same keys (i.e., A, C, D, F). Give
an example of such keys, and draw the 3-level tree so generated.
9. Consider a set S = {49, 24, 82, 92, 35, 54} of primary key values for the tuples in a relation.
Draw a B+ tree containing these key values starting with an empty B+ tree and inserted
in the given order. Assume that internal nodes can have at most 2 key values and leaf
nodes have at most 2 key values. Also assume key values in left child node are no greater
than in parent, and key values in right child node are greater than parent. Only show
the final state.
Good Luck

You might also like