AlgoScope

Expression Evaluation

Two stacks, values and operators, evaluate infix in one pass. Brackets fence the operator stack.

Stack and queue algorithms, algorithm, intermediate
Character (. Values empty, operators (.invalops(3+4)*2-8/4(

Stacks for Expressions: Evaluate infix with two stacks

Decision, step 2 of 13

'('. An opening bracket fences the operator stack.

How stacks for expressions works

Cost

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

Before this

Leads to

Topics that need this one first.

Taught by the same lesson

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