By traversing tree either preorder or inorder or postorder and storing the
partial sums along the way and comparing the partial sums with the required
sum can solve the problem

On Wed, Jun 29, 2011 at 7:56 PM, Akshata Sharma
<[email protected]>wrote:

> How to find a path in a given binary tree which sums up to a given target
> value?
> for example if the given BT is
>
>    5
>   / \
>  3   2
>  /
> 7
> and if the target is 10, then the path is ---- root(5) + left node(3) +
> right node (2).
>
> --
> 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.

Reply via email to