标签:
Step 1:
Use the key to find this node in BST, time complexity is log(n)
Step 2:
after finding this node, we have 3 different conditions:
1, if this node‘s left and right children are null, just set this node‘s parent‘s link to this to null;
2, if this node only has one child, just replace this node with it‘s child;
3, if this node has two children, then we need to find the minimum key node in this node‘s right subtree, then replace this node with the minimum key node, then delete this minimum key node in the right subtree.
标签:
原文地址:http://www.cnblogs.com/dingjunnan/p/5417784.html