D B ய A F C G
Explain post order traversal and find the post order traversal for the following:
The post order traversal is one of the ways to traverse the tree data structure and is used for traversing the nodes in the tree. This traversal follows the principle of Left Right Root which means the left subtree of the root will be traversed first, after that the right subtree, and then, the root node will be traversed.
Here, there are 7 nodes, A as root node and rest 6 as left or right subtree of the root node.
As Post order Traversal works on Left Right Root, the following are the steps by which we can traverse the post order :
A is the root node for the tree, so first of all we will traverse the left subtree which is as follows:
In the left subtree we can say that B is the root node, D is the left subtree and E is the right subtree. So, the post order traversal will be :
D, E, B
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images