you are given a BST where each node has a integer value, parent pointer, left and right pointers. Write a function to find a path with a given sum value. Path can go from left subtree tree , include root and go to right tree as well . We need to find these paths also.
5
/ \
1 10
/ \ / \
0 2 6 11
so to find 16 we say it is 1 to 5 to 10.
Solution:
Unsolved but idea is to store the visited nodes and keep checking left and right.
I have written a solution here http://groups.google.com/group/algogeeks/msg/c2beb8228d5da75b
Please look at the attachment.