It is a simple algorithm
1) If node has no child, simply delete
2) If node has one child, replace node's data with child's data and
make the subtree child of node, delete child.
3) if node has two child, find the node with min key in right subtree
(or max in left subtree), call it x, replace node's data with x's and
recursively call deleteNode on x.
Since there have been a couple of DS book recos, i would like to add
one which I used and found extremely good. Data Structures in C++ by
Mark Allen Weiss. All frequently used/asked DS algos are present in
that book and more!
Thanks,
Navneet
On Mon, Jul 4, 2011 at 4:58 AM, amit kumar amitthecoo...@gmail.com wrote:
use cormen
On Sat, Jul 2, 2011 at 9:14 AM, shady sinv...@gmail.com wrote:
http://webdocs.cs.ualberta.ca/~holte/T26/del-from-bst.html
google it there are lot of resources
On Sat, Jul 2, 2011 at 8:59 AM, sameer.mut...@gmail.com
sameer.mut...@gmail.com wrote:
how to Delete a node in a BST. Handle All Test cases.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
--Navneet
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.