 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
Removing
a node with 2 children
|
|
|
|
– |
Remember
that traversing a tree INORDER causes us
|
|
|
to
traverse our keys in the proper sorted order.
|
|
|
|
– |
So,
by traversing the binary search tree in order,
|
|
|
|
starting
at the to-be-deleted node (i.e., the to-be-
|
|
|
|
replaced
node)...we can find the search key to replace
|
|
|
|
the
deleted node by traversing the next node
|
|
|
|
INORDER.
|
|
|
|
– |
It is
the next node searched and is called the inorder
|
|
|
|
successor.
|
|