Hmm, it is strange that you are discusing such a basic thing. You should not
post your homework here, but maybe some research problems.
This is so easy stuff, that many people may make mistake when explaining it.

But if node has right child, then the successor is minimum of that subtree.
But if it does not ,you must go up, until you come from the left side , and
that node you come to is successor.


2009/2/14 mohamad mehdi kharatizadeh <mehdi.insomn...@gmail.com>

>
> This would be the case of binary heaps, not binary search trees.
> And also if a given node X that does not have any right child, may have a
> successor, consider the minimum element of a given binary search tree T,
> that would be the leftmost node in the tree T, it is a leaf and thus it
> does
> not have any right child, but it has a successor which is it's parent
> directly, so you may have to go up the tree to find a successor if node X
> does not have any right child.
>
> -----Original Message-----
> From: algogeeks@googlegroups.com [mailto:algoge...@googlegroups.com] On
> Behalf Of rakesh sathu
> Sent: Saturday, February 14, 2009 1:21 PM
> To: algogeeks@googlegroups.com
> Subject: [algogeeks] Re: [algogeeks]
>
>
> If it is a binary tree follow this.. * Right shift of the node(in
> number) gives you the left child of that node
> * Add binary 1 to the above result to get right child
> * To find node from a child do right shift
>
> On 2/10/09, praba garan <prabagara...@gmail.com> wrote:
> > how to find the successor of an element in a tree ??
> >
> > thank u
> >
> > >
> >
>
>
> --
> Thank you,
> Rakesh Reddy.S
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to