from each node , make 4 recursive call 1) you consider this node as part of the solution i.e left=target - currentNode->data is passed , and consider current->left for next recursion 2)you consider this node as part of the solution i.e left=target - currentNode->data is passed , and consider current->right for next recursion 3) do not consider this node as part of the solution i.e target is passed and consider current->left for next 3) do not consider this node as part of the solution i.e target is passed and consider current->right for next recursion
keep track of path in an arr[] as you move on. On 11/15/12, Amitesh Singh <[email protected]> wrote: > Given a binary search tree and a target value, find all the paths (if there > exists more than one) which sum up to the target value. It can be any path > in the tree. It doesn't have to be from the root. > -- > Amitesh > > -- > > > --
