Solution Review: Print Post-order Traversal

Let’s take a detailed look at the previous challenge’s solution.

Solution

In post-order traversal, a node’s left child is visited first, then its right child, and then the value stored in the current node. This approach is followed recursively for each node in the tree until we reach the leaf node. Refer to the following diagram to better understand the algorithm. The dotted arrow shows the path taken by the algorithm.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.