for your question -

On Sun, Sep 18, 2011 at 3:44 PM, abhishek sharma <[email protected]>wrote:

> hi prasanth,
>
> i was asked a similar ques but with the condition that path shud terminate
> at a leaf node & u just have to return true if you are able to find a path.
>
> what i did was,
>     - do an inorder traversal (u have to pass a parameter that represents
> sum as well along with treenode pointer)
>     - at every leaf check the value of cumulative sum of all the parents'
> data and the current node's data
>
> for printing paths u can use a stack
>
>
>
>
> On Sun, Sep 18, 2011 at 2:26 PM, prasanth n <[email protected]> wrote:
>
>> You are given a binary tree in which each node contains a value. Design an
>> ALGORITHM to print all paths which sum up to that value. Note that it can be
>> any path in the tree - it does not have to start at the root.
>>
>> --
>> *prasanth*
>>
>> --
>> 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.
>>
>
>
>
> --
> Nice Day
>
> Abhishek Sharma
> Bachelor of Technology
> IIT Kanpur (2009)
>



-- 
Nice Day

Abhishek Sharma
Bachelor of Technology
IIT Kanpur (2009)

-- 
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