Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS

When converting the infix expression "(a+b)*(c-d)/e" to postfix, how many operator symbols appear in the postfix output?

  1. A. 5
  2. B. 3
  3. C. 6
  4. D. 4

Correct answer: D. 4

The operators are +, -, *, / (four in total), and the parentheses are removed by the shunting-yard algorithm. Counting the operand letters (five) is a different count.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic