Skip to main content
gamedev.net
🔒 Locked

trees

Started by nodoubt 1 reply 500+ views
Original Post
nodoubt
nodoubt
is there a way to transverse a tree (binary) without using recursion? i.e. inorder, postorder, preorder without using recursion... it''s hard to keep track of what''s going on in recursion.. thanks
I'm a newbie, please don't hurt me!
Shannon Barber
Shannon Barber
Recursion is easiest. You can also maintain your own stack of nodes (perform the recursion manaually) or you can use a threaded tree which allows non-recursive in-order transversals.
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
C-Junkie
C-Junkie
you can use a stack and a loop, but this is pretty similiar to recursion...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.