@mac: just to clear my understanding, u need to print paths that sum up to a Value which means the value of the nodes in a path is added right to see if it satisfies this Value? does the value at each node have any relevance as such? I mean can it be any value at any node or does value at a node satisfy something like a bst property?
On Fri, Aug 19, 2011 at 2:04 PM, anshu mishra <[email protected]>wrote: > start from leaves.(leaves have possible sum only its value) > go up step by step > save all the possible sums on that node. > > for example > if left node has possible sums( 4, 6, 7 ,13) and right node has > possible sums (3, 5, 9); and node itself value has 5 than > this node all possible sums will be (8, 10, 11, 12, 14, 18) > > till u reach the root node u have all possible sums at each node. > > search ur desired sum node in the tree track all possible path for that > sum(u have to just only downside of the tree). > > > > -- > 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. > -- "People often say that motivation doesn't last. Well, neither does bathing - that's why we recommend it daily." -- 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.
