Binary tree post order traversal in Java with example

In last couple of articles, we have learned about pre-order and in-order tree traversal in Java and today, you will learn about the post order traversal in binary tree. The post order traversal is also a depth-first algorithm because you go deep before you visit other nodes in same level. In post order traversal, you first visit left subtree, then right subtree and finally you print the value of node or root. That's why the value of root is always printed last on post order traversal. Like many tree algorithms, the easiest way to implement post-order traversal is by using recursion. In fact, if you know how to write pre-order using recursion, you can use the same algorithm with bit of adjustment to implement post order traversal. All you need to do is instead of printing the value of node first, just call the recursive method with left subtree as shown in our example.
Read more »