Question 1Easy
Which traversal of an expression tree, with parentheses added around each subexpression, gives the usual infix form?
- Level order
- Postorder
- Inorder
- Preorder
Answer: C. Inorder
Explanation
Inorder visits left operand, operator, right operand.
Step-by-step solution
- Inorder visits left operand, operator, right operand.
- That is how infix expressions are written, e.g. (3 + 4).
- Adding brackets around each subtree keeps the precedence correct.
Why the other options are wrong
- A. Level order mixes operands from different subexpressions.
- B. Postorder gives postfix (reverse Polish) notation.
- D. Preorder gives prefix (Polish) notation.