数据结构习题1

advertisement
Written Assignment 4
This should be done individually.
0. Let hn be the maximum height of an AVL tree with n nodes. Find an upper bound of hn as an
expression of n.
1. Insert the following keys cup, cop, copy, hit, hi, his, hig, cope, starting from the empty AVL
tree, then remove hi. Draw every stage of the AVL-tree before and after every rotation.
2. Insert the following keys a,b,c,…,r,s,t starting from the empty B+tree of order m=5 and L=5.
Draw every stage of the B+tree before and after every splitting. Note that B+tree is the same as the
B-tree in our text.
3. Remove o, p, r and s from the previous B+tree. Draw every stage before and after every
merging.
4. For the definition of B+-trees answer the following questions:
a) Why every internal node except the root must be half full?
b) Why the root can have two children?
c) Why the leaves must be half full?
d) Can you derive a height bound for a (M,L)B+ tree with N data items?
Download