now the fun begins if the deleted node has two childrenyou can' just replace it with one of these childrenat least if the child has its own children why notexamine figure and imagine deleting node and replacing it with its right subtreewhose root is which left child would havethe deleted node' left child or the new node' left child in either case would be in the wrong placebut we can' just throw it away we need another approach the good news is that there' trick the bad news is thateven with the trickthere are lot of special cases to consider remember that in binary search tree the nodes are arranged in order of ascending keys for each nodethe node with the next-highest key is called its inorder successoror simply its successor in figure anode is the successor of node here' the trickto delete node with two childrenreplace the node with its inorder successor figure shows deleted node being replaced by its successor notice that the nodes are still in order (there' more to it if the successor itself has childrenwe'll look at that possibility in moment figure can' replace with subtree figure node replaced by its successor finding the successor how do you find the successor of nodeas human beingyou can do this quickly (for small treesanywayjust take quick glance at the tree and find the next-largest number following the key of the node to be deleted in figure it doesn' take long to see that the successor of is there' just no other number which is greater than and also smaller than howeverthe computer can' do things "at glance,it needs an algorithm