Diagonal Sum of a Binary Tree - Programming Interview Question - IDeserve
Consider lines drawn at an angle of 135 degrees which cut through the left-branches of a given binary tree.A diagonal is formed by nodes which lie between two such consecutive lines. If we are able to draw 'n' lines then tree nodes are divided into 'n+1' diagonals.
Diagonal sum in a binary tree is sum of all node's values lying between these lines. Given a Binary Tree, print all diagonal sums.
Read full article from Diagonal Sum of a Binary Tree - Programming Interview Question - IDeserve
No comments:
Post a Comment