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.

Get hands-on with 1400+ tech skills courses.