- #1
- 2,593
- 5
The following diagram is from the section in my notes titled "Operations on Binary Search Trees". Specifically it explains via pseudocode how to implement a delete function for a BST:
http://img410.imageshack.us/img410/4225/deletetreexz0.jpg
What I don't understand in the 2nd box is why "return T.left" is written. I thought the purpose of deleting a tree node in a BST would be to literally delete the object corresponding to the tree node. Instead the pseudocode appears to return the child node of the node to be deleted. Why is this done?
http://img410.imageshack.us/img410/4225/deletetreexz0.jpg
What I don't understand in the 2nd box is why "return T.left" is written. I thought the purpose of deleting a tree node in a BST would be to literally delete the object corresponding to the tree node. Instead the pseudocode appears to return the child node of the node to be deleted. Why is this done?
Last edited by a moderator: