Deleting from a BST
Cases
:
•
Delete a leaf
–
easy
•
Delete a node with just one
child
–
delete and replace with child
•
Delete a node with two
children
–
delete node’s
successor
–
write successor’s data into
node
•
How do we find the
successor?
•
The successor always has at
most one child.
Why?
•
Would work just as well
using predecessor instead of
successor
CS409 - Spring 2000
3