Consider the following expression tree. Tree: root is '+'; its left child is 'a' and its right child is '*'; the '*' node has left child 'b' and right child…
Consider the following expression tree.
Tree: root is '+'; its left child is 'a' and its right child is '*'; the '*' node has left child 'b' and right child 'c'.
In-order, pre-order and post-order traversal of this tree will result into which of the following expressions, respectively.
Show answerHide answer
Correct answer: (C) a+b*c, +a*bc, abc*+
Explanation
In-order (left, root, right) gives a+b*c, pre-order (root first) gives +a*bc, and post-order (root last) gives abc*+.