Vertical Sum of a Binary Tree

please explain doubly linked list method in words

Anonymous - Apr 6, 2014

please explain doubly linked list method in words

Added the basic algo for that:
1. Start with the root node and empty double list listNode
2. Add the value of the rootNode to the current listNode
3. Now whenever you go left, pass listNode.left and root.left and call step1 and 2 recursively.
4. Similarly for right node

Please let me know if I have not explained it properly.

There is a typo in this algo the code should be
t->next=listnode; @ line number 20 in pseudocode

Thank you for helping me fix it. I have updated the code.


See also