Consult Tanenbaum buddy. It has provided a proper in-order traversal code.
You will have to think a bit on that on your own too to get to post and pre
order.

Hint:
- Check the sequence in which the elements are pushed and popped in stack.
e.g. for pre order, print the node value as you reach any root and then push
it in stack. then move to left sub tree. repeat till NULL, then pop out the
last node pushed in, take the right sub-tree and proceed again, do till no
nodes are left and stack is empty.

On 15 August 2011 18:37, rohit <raman.u...@gmail.com> wrote:

> Can anyone give algorithm for non recursive preorder and postorder??
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/CMDjAwgewoYJ.
> 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.
>



-- 
___________________________________________________________________________________________________________

Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees

-- 
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