In this recipe, we will perform postorder traversal of a binary tree without recursion. This will be done through non-recursive calls to the function.
Performing postorder traversal of a binary tree non-recursively
Getting started
To create a binary tree, refer to the Creating a binary search tree and performing an inorder traversal on it recursively recipe. We will be performing postorder traversal on the same binary tree we created in this recipe.
How to do it...
For postorder traversal of a binary tree, we need to apply three tasks—L, R, and V—on each...