Why does Reverse Polish Notation use a stack?
Practice this question from Evaluate Reverse Polish Notation - Stack evaluation Pattern Practice Quiz, with options and an explanation.
Question
Why does Reverse Polish Notation use a stack?
Option A — Correct answer
Operators consume the two most recent operands
Option B
Tokens are sorted first
Option C
Every token is a bracket
Option D
The expression is a graph
Explanation
Operands wait on the stack until an operator consumes the two most recent values.