D B ய A F C G

icon
Related questions
Question

Explain post order traversal and find the post order traversal for the following: 

D
B
ய
A
F
C
G
Transcribed Image Text:D B ய A F C G
Expert Solution
Step 1: Introduction-Post Order Traversal

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.

Step 2: Left Subtree Traversal

Data structures and Algorithms homework question answer, step 2, image 1

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:

Data structures and Algorithms homework question answer, step 2, image 2

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

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer