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 ?

  1. A.

    An operator stack

  2. B.

    An operand stack

  3. C.

    An operand stack and an operator stack

  4. D.

    A parse tree

Attempted by 95 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: Gate Guidance By Sanchit Sir