If I'm not mistaken what you are doing is assigning column indices to each
node.
0 to the root and every time it goes to the left you subtract one and every
time it goes to the right you add one... correct?

It will fail for this example:
                                 12
                                /    \
                              /        \
                             6         8
                           /   \       /  \
                          /     \     /    \
                        13   10  1     90
                              /   \       /  \
                            /     \     /    \
                         14   15  16    17
                        /   \       /  \
                       /     \     /    \
                     17  18  19   20
                    /   \       /  \
                   /     \     /    \
                21     22  23   24


On Thu, Aug 25, 2011 at 8:06 PM, Shravan Kumar <shrava...@gmail.com> wrote:

> @Anup
>
> Can you please elaborate why it will not work?
>
>
> On Thu, Aug 25, 2011 at 8:02 PM, Anup Ghatage <ghat...@gmail.com> wrote:
>
>> Naren:
>> It wont work for tree's of level > 3 and non-complete binary trees
>>
>>
>>
>>
>> On Thu, Aug 25, 2011 at 6:49 PM, Naren s <sweetna...@gmail.com> wrote:
>>
>>> let intialize the count be equal to zero and pass it to left nodes as
>>> well as right nodes.
>>>
>>> verticalsum(struct node* node,int count)
>>> {
>>> verticalsum(node->left,count-1);
>>> hash(count)+=node->data;
>>> verticalsum(node->right,count+1);
>>>
>>> }
>>>
>>> On Wed, Aug 24, 2011 at 9:18 PM, Nikhil Veliath <nve...@gmail.com>wrote:
>>>
>>>> find the vertical sum of a binary tree .  .  . wat do we mean by
>>>> vertical sum anyone any help
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> algogeeks+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>>
>>>
>>> --
>>> *Narayanan S,*
>>> B.E., C.S.E., (final year),
>>> College Of Engineering Guindy,
>>> Anna University,
>>> Chennai-25.
>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Anup Ghatage
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Anup Ghatage

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to