Preorder tree traversal without using recursion.
Simplest method are using a stack. and perform Preorder tree traversal.
Suppose following node are contain in binary tree.
Inorder : 1 2 4 3 8 10 9 30
Function : Preorder traversal using stack.
View pointers and code execution process.
view stack pointers.
Try it Yourself
C program for preorder traversal of binary tree. time complexity O(n).