Re: [algogeeks] Amazon Ques Suggest Algo

2011-10-20 Thread SUMANTH M
- Take another sum array which contains sums of original array at each index, here sum[0] = a[0]; sum[1] = a[0] + a[1] ;...sum[i]=a[0]+a[1]+...a[i]; - Traverse the sum array and search for duplicates. ex: a[] = {1,2,-4,-3, 6 ,-3}; s[] = { 1,3,-1,-4,2,-1 }; In the sum array we have

[algogeeks] print vertical sums of a binary tree

2011-10-15 Thread SUMANTH M
Hi, A binary tree is given we need to print vertical sums of nodes. for example 12 34 5 | | 5| | | | / | \ | | | | / |8 | | | / | / |\| | 4 |/| 10 |/ |