Computer Science, asked by bunnyowl5266, 1 year ago

Given a binary tree, such that each node contains a number. Find the maximum possible sum in going from one leaf node to another.

Answers

Answered by Anonymous
0

Answer:

Given a binary tree in which each node element contains a number. Find the maximum possible sum from one leaf node to another.

The maximum sum path may or may not go through root. For example, in the following binary tree, the maximum sum is 27(3 + 6 + 9 + 0 – 1 + 10). Expected time complexity is O(n).

If one side of root is empty, then function should return minus infinite (INT_MIN in case of C/C++)

Similar questions