CSCI 2720 Data Structures (spring 2009)

Written Assignment 2 (Due Monday March 16, 2009)

Choose any 4 questions out the 5 given to answer. However, all the questions are within the scope of learning so you need to be able to answer them all.
  1. Give an example of deleting a node from a binary search tree (of a reasonable size), where the node has both left and right children. Using the example to explain how to replace it with its inorder predecessor or inorder successor.

  2. Write a function (in pseudo-code) to identify the inorder predecessor of a given node on a binary search tree.

  3. Show an example of constructing an minimum cost binary search tree, for a list of 4 keys (with probabilities of being looked up), that counters our intuition on how the tree may look like. You need to construct the tree using the idea and strategies described in the class/note.

  4. For your example in 3, fill the corresponding dynamic programming table, in which each cell should contain both the minimum cost and the splitting position k.

  5. Give AVL tree examples to explain each of the cases: single left rotation, single right rotation, double LR rotation, and double RL rotation.