To complete our discussion of Binary Search Trees we need to discuss the bstDelete operation. The process would go something like the following:

Search for a node containing the "key" value

if (key not found)
return
else if (either subtree is empty)
{
delete the node replacing the parents link with the
ptr to the nonempty subtree or NULL if both
subtrees are empty
}
else
{
Traverse the left subtree of the node to be deleted
such that you find the rightmost node (Rnode) in the left
subtree

Move the content of Rnode to the node to be deleted

Set Rnode's parent pointer to point to the left subtree
of Rnode

Free the storage from the unused node
}
Let's take a look at the following BST:

              10
         5           15
      2     8     12     16
          7          14

P#1: Assume that you always start with the above tree, how would each of the following nodes be deleted?

8

12

5

15

10


P#2: How would you change the existing BT ADT to make deletion of a node in a BST easier?