Post-Order Traversal in Binary Search Tree

In this lesson, we will cover the third and last traversal strategy for a Binary Search Tree—Post-Order Traversal—and implement it in code by using an example.

Post-order Traversal

In this type, the elements are traversed in a “left-right-root” order: We first visit the left child node, then the right child, and then comes the turn of root/parent node.

Follow the steps below to perform Post-Order Traversal, starting from the root node:

  • Traverse the left sub-tree of currentNode, recursively using PostOrder() function.

  • Traverse the right sub-tree of currentNode, recursively using PostOrder() function.

  • Visit current node and print its value.

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