[algogeeks] Re: Convert a Binary tree into spike.

2010-05-13 Thread Dave
Do a post-order traversal, keeping track of the level in the tree. As you visit each node, remove it from the tree and add it to the spike. Use the left pointer to point to the next level, and the right tree pointer for each level of the spike. If you visit the right subtrees before the left

Re: [algogeeks] Re: Convert a Binary tree into spike.

2010-05-13 Thread Sathaiah Dontula
Using BFS we can do it. Thanks, Sathaiah On Thu, May 13, 2010 at 6:48 PM, Dave dave_and_da...@juno.com wrote: Do a post-order traversal, keeping track of the level in the tree. As you visit each node, remove it from the tree and add it to the spike. Use the left pointer to point to the next