[algogeeks] Re: Non recursive preorder and postorder

2011-08-15 Thread Don
It can be done without using a stack, by using the pointers in the
node to keep track of the path back up the tree. The algorithm will
temporarily modify the tree, but when completed the tree will be
restored to its original state.
Don

On Aug 15, 8:07 am, 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 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.



[algogeeks] Re: Non recursive preorder and postorder

2011-08-15 Thread Navneet
I think only condition given is not to use recursion, so auxiliary
data structures can be used.


On Aug 15, 7:30 pm, ankit sambyal ankitsamb...@gmail.com wrote:
 Morris in order traversal will do in order traversal without using recursion
 or a stack.

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



Re: [algogeeks] Re: Non recursive preorder and postorder

2011-08-15 Thread sukran dhawan
u can use threaded binary trees to avoid stacking

On Mon, Aug 15, 2011 at 9:48 PM, Navneet navneetn...@gmail.com wrote:

 I think only condition given is not to use recursion, so auxiliary
 data structures can be used.


 On Aug 15, 7:30 pm, ankit sambyal ankitsamb...@gmail.com wrote:
  Morris in order traversal will do in order traversal without using
 recursion
  or a stack.

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