10
4 5
2 7 6 11
1 3 9 8 12 13 14 15
i think we should first find the parent of the particular node ..then apply
the concept as told by Brijesh on it ....
p =parent(q);
r = parent(p);
count =1;
while(p ==isright(r))
{
p=r;
r=parent(r);
count++;
if(r==root)
break;
}
if(d =right(r))
{
while(count!=0)
{
if(d->left)
d=d->left;
else d=d->right;
count--;
}
}
else return NULL;
o/p=d->value;
--
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.