Data Structures & Algorithms · Problem type

Evaluate a postfix expression

Use this for “Evaluate the postfix expression 3 4 + 2 × 7 − with a stack.”

Put in order

Put the stack operations for 3 4 + 2 × 7 − in order.
1
?
2
?
3
?
4
?
5
?
6
?
7
?

Assumptions

•
Postfix writes each operator after its two operands, so no brackets are needed.
•
Read left to right: a number is pushed; an operator pops two numbers and pushes its result.
•
The first number popped is the right operand: for − it is taken away from the second.
•
At the end the stack holds one number, the value of the expression.
Topic check
See what you know: 5 questions on this topic
New questions each time. Pass to mark it complete.

Related lessons

© 2026 SME. All rights reserved.