Which of the following is essential for converting an infix expression to the…
1997
Which of the following is essential for converting an infix expression to the postfix from efficiently ?
Answer: A. An operator stack — When converting an infix expression to postfix using the standard Shunting-Yard algorithm, operands (like A, B, C) are directly appended to the output string…
- A.
An operator stack
- B.
An operand stack
- C.
An operand stack and an operator stack
- D.
A parse tree
Attempted by 371 students.
Show answer & explanation
Correct answer: A
When converting an infix expression to postfix using the standard Shunting-Yard algorithm, operands (like A, B, C) are directly appended to the output string as soon as they are read.
Only operators (like +, -, *, /) and parentheses need to be temporarily stored and reordered based on precedence and associativity. Therefore, you only require a single stack to hold operators. An operand stack is not needed for the conversion itself (it is only used later if you want to evaluate the postfix expression).
Explore the full course: Iocl Engineers Officers Grade A Paper 2