Computer Science, asked by TbiaSamishta, 10 months ago

The post order traversal of binary tree is debfca. Find out the preorder traversal

Answers

Answered by muskanc918
0

Since Root is the last node to be traversed in a post order traversal we know one thing for sure. A is the root.

Next, we are left with only DEBFC. Here some of the nodes belong to the left side of the binary tree and some belong to the right side. How many nodes belong to the left and how many belong to the right. Since left side of the binary tree is considered first, and since every node is expected to have at most two child, DEB will be the left side of the binary tree and FC would be the right.

Answered by Sidyandex
0

The preorder transversal method actually follows a different approach than post order.

In post order, the nodes are as per the left, right and then the parent node, whereas, in pre-order, the method goes like, parent node, left and right.

Since the tree is of debfca, you need to open up the node and make a tree out of it, then as per the formula make a post-order tree that will be abcdef.

Similar questions