• Tutorials
  • DSA
  • Data Science
  • Web Tech
  • Courses
August 23, 2024 |14.5K Views

Iterative Postorder Traversal

Description
Discussion

The idea is to move down to leftmost node using left pointer. While moving down, push root and root’s right child to stack. Once we reach leftmost node, print it if it doesn’t have a right child. If it has a right child, then change root so that the right child is processed before.

1.1 Create an empty stack

2.1 Do following while root is not NULL
   a) Push root's right child and then root to stack.
   b) Set root as root's left child.

Iterative Postorder Traversal : https://www.geeksforgeeks.org/iterative-postorder-traversal-using-stack/