Consider the following tree If the post order traversal gives ab-cd*+ then the…
2017
Consider the following tree

If the post order traversal gives ab-cd*+ then the label of the nodes 1,2,3,… will be
- A.
+,-,*,a,b,c,d
- B.
a,-,b,+,c,*,d
- C.
a,b,c,d,-,*,+
- D.
-,a,b,+,*,c,d
Attempted by 285 students.
Show answer & explanation
Correct answer: A
Post-order traversal visits nodes in the order: Left Subtree, Right Subtree, Root.
Given the post-order string 'ab-cd*+', we can reconstruct the expression tree: 1. Operands 'a' and 'b' form a subtree with root '-'. 2. Operands 'c' and 'd' form a subtree with root '*'. 3. The final operator '+' combines the '-' and '*' subtrees as its left and right children respectively.
The specific labels for nodes 1 through 6 depend on the diagram's numbering convention (e.g., level-order or pre-order), which is typically provided in the question image.
A video solution is available for this question — log in and enroll to watch it.