Data Structures & AlgorithmsHardGATE CS · TCS NQT · Product Company SDE

Evaluate the postfix expression: 6 3 + 7 + 9 +

  1. A. 26
  2. B. 25
  3. C. 24
  4. D. -25

Correct answer: B. 25

Scan left to right with a stack: push operands, and on an operator pop b then a and push a op b, preserving operand order (important for - and /). Result 25.

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

Exams that ask this topic