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

Evaluate the postfix expression: 4 3 5 + * 3 -

  1. A. 35
  2. B. 27
  3. C. 29
  4. D. 44

Correct answer: C. 29

Scan left to right with a stack: on an operator pop b then a and push a op b (note the order for −). Result 29.

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

Exams that ask this topic