int getDistance(Tnode *root,Tnode *node,int dist)
{
if(root==NULL)
return 0;
if(root==node)
return dist;
return
getDistance(root->left,node,dist+1)|getDistance(root->right,node,dist+1);
}
Thanks & Regards,
Anantha Krishnan
On Thu, Aug 25, 2011 at 2:30 AM, rohit <[email protected]> wrote:
> How to find the distance of a node from the root of the tree??
> Give algorithm.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/hL50R3KOgGgJ.
> 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.
>
--
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.