pseudo code
three cases are possible
1.node has left and right child
then inorder succesor will be leftmost child of right child
2. node has left child and no right child or no left and right chid
if node is left child of it's parent then inorder succesor is it's
parent only
if node is right child of it's parent then keep on moving upwards until
you find a parent which is left child of it's parent
then it will be the inorder succesor....if you reach node then no inorder
succesor
--
*UTKARSH SRIVASTAV
CSE-3
B-Tech 3rd Year
@MNNIT ALLAHABAD*
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.