Post-Order Traversal

In this lesson, we will cover Post-Order Traversal in a Binary Search Tree and implement it in JavaScript.

Introduction #

In the post-order traversal, the current node will be visited after its children nodes. Therefore, it is called the post-order traversal.

The root of the tree will always be the last one to be visited.

In post-order traversal, the elements are traversed in “left-right-root” order.

Here is a high-level description of the post-order traversal algorithm:

  1. Traverse the left subtree of the currentNode recursively by calling the postOrderPrint() function on it.

  2. Traverse the right subtree of the currentNode recursively by calling the postOrderPrint() function on it.

  3. Visit the current node and print its value.

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