Given a binary tree with no size limitation, write a program to find the
sum of each vertical level and store the result in an appropriate
data structure (Note: You cannot use an array as the tree can be of any
size).

                                                     4
                                                 /       \
                                               7          8
                                           /      \      /  \
                                         10      11 /     13
                                                   12

here 4(root) , 11(leftsubtree's right child ), 12 (rightsubtree's
left child) are in same vertical Line


so here vertical line 1 is from 10
vertical line 2 sum is 7

vertical line  3 sum is 4+11+12=27 (May Have Some Doubt So i Have
represented the figure in correct way)

vertical line  4 is 8
vertical line  5 is 13





--

"To Iterate is Human, To Recurse is Divine"

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