sum(node *root)
{
if(node==NULL)
return 0;
curr_data=root->data;
root->data=sum(root->left)+sum(root->right);
return root->data+curr_data;
}
On Sat, Dec 10, 2011 at 11:07 PM, AMAN AGARWAL <[email protected]> wrote:
> Hi,
>
> Given a Binary tree where nodes may have positive or negative value, store
> the sum of the left and right subtree in the nodes.
>
> Regards,
> Aman.
>
> --
> AMAN AGARWAL
> "Success is not final, Failure is not fatal: It is the courage to continue
> that counts!"
>
> --
> 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.
>
--
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.