previous | start | next

Case 1: Deleting a Node with < 2 children

Deletion is easy. In this case the node to be deleted is the root of a subtree, but one link (left or right) is null. Just "promote" the other child to be the new root of the subtree.

The Node with key = 20 below has only one child, 30. To delete 20, "promote" the subtree at 30 to take 20's place as the child of 40.

20 is a node in the binary search tree with less than two children

After deleting 20, the subtree at 30 "moves up":

Node with key 20 had null left link, it is replaced by the subtree at its right link.



previous | start | next