โ Back to the stacks page
Expression / Call Stack
The stack as an evaluator: operators and operands are pushed, precedence decides when to reduce. Every interpreter and calculator works this way.
What to know
- Shunting-yard converts infix to postfix (RPN) using an operator stack.
- Postfix evaluation needs only one operand stack โ no precedence left.
- Recursion depth limits are simply call-stack capacity limits.
In the wild: Compilers, calculators, SQL/JSON expression engines, the JVM operand stack.
Algorithms to reach for
Shunting-yard
O(n)Infix โ postfix respecting precedence/parentheses
RPN evaluation
O(n)Evaluate postfix expressions (LeetCode 150)
Basic calculator
O(n)Evaluate strings with +โรรท and parens (LeetCode 224)
Practice problems โ with full guides
Each problem has its own page: progressive hints, how to approach it, and the full solution.