Hope This will Work..
int Recursion(node *root)
{
if(root->left==Null&&root->right==Null)
{
return root->data;
}
int a=0,b=0;
a=recursion(root->left);
b=recursion(root->right);
if(a+b+root->data>max)
max=a+b+root->data;
return max(a,b)+root->data;
}
--
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.