in DS retagged by
355 views
4 votes
4 votes
The in-order traversal of a binary tree is $\textsf{HFIEJGZ},$ and the post-order traversal of the same tree is $\textsf{HIFJZGE}.$ What will be the total number of nodes in the left sub-tree of the given tree? (It is NOT a search tree)
in DS retagged by
355 views

2 Answers

1 vote
1 vote
Post order says “ Left Right Root”

In order  says “ Left Root Right”

So from the given Post order it is easy to say E is at the root.

now come to the Inorder there are three node elements which is left to E so all three are part of the left subtree which is “HFI”.
0 votes
0 votes

$In-order$ traversal:
$\color{Red}\textsf{HFIEJGZ}$

$Post-order$ traversal:
$\color{Green}\textsf{HIFJZGE}$

Left-Subtree has $3$ nodes.