Bugdude wrote:I thought the OP wanted an iterative solution, not recursive.
Unclear, but you might be right.
If you are allowed to use a stack, you can remove the recursion, but this is not a truly iterative solution.
If your tree also has pointers to the parent node then it's doable. For instance, you can keep a pointer to the previously visited node, so you can always know whether you are visiting the current node from the parent (first visit), or you are coming back from the left subtree or your are coming back from the right subtree. If you are coming from the parent, go to the left; if from the left, go to the right; if from the right, go to the parent. Stop the loop when you come back to the root.
I'll write some code later if I have the time.