I'm pretty sure I screwed up the iterative example logically and in terms of efficient code flow, so please edit/comment with fixes. Wikipedia has a good article on tree traversal for better examples (most seem to be binary trees unfortunately). There's also a way to avoid using a stack if you maintain some extra pointers in the Node object as per this StackOverflow answerthis StackOverflow answer.