
CS 2420 - Written 2
Due September 19
1. Show the result of accessing the keys 3, 9, 1, 5 in order in the splay
tree in the file splay.gif. Draw the tree after each access.
2. Show that via AVL single rotations, any binary search tree T1can be
transformed into another binary search tree T2with the same items.
Describe a transformation algorithm using plain English. (Hint: use
recursion.)
3. Suppose we want to add the operation findKth to our repertoire of
AVL tree operations. The operation findKth returns the kth smallest
item in the tree. Assume all items are distinct. Explain how to mod-
ify the AVL tree to support the operation in O(log N) time, without
sacrificing the time bounds of any other operation. (Hint: you may
store extra information at each node.)
1