AlgoScope

Postfix Evaluation

Push numbers. An operator pops two, applies itself, and pushes the result.

Stack and queue algorithms, algorithm, beginner
Push 2.instk23*4+5-2
Push 2.instk23*4+5-2

Stacks for Expressions: Evaluate postfix

Decision, step 2 of 9

Push 2. The stack is now 2.

How stacks for expressions works

Cost

Best
O(n)
Average
O(n)
Worst
O(n)
Space
O(n)

Before this

Taught by the same lesson

Stacks for Expressions covers these too, in the same run.