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 level, and the right tree
> pointer for each level of the spike. If you visit the right subtrees
> before the left subtrees, then you can add the nodes to the beginning
> of the linked list for its level in the spike.
>
> Dave
>
> On May 12, 10:48 pm, vinayan c <vinayan1...@gmail.com> wrote:
> > Something like this
> >                         1
> >                 2               3
> >           4         5     6        7
> >
> >  1
> >  |
> >  2->3
> >  |
> >  4->5->6->7
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> > To post to this group, send email to algoge...@googlegroups.com.
> > To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> > For more options, visit this group athttp://
> 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 algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@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 algoge...@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