AlgoScope

Infix to Postfix

AlgorithmintermediateStack Patternsalso called shunting-yard

Operands go straight to the output; operators wait on a stack until a lower-precedence one arrives.

Decision · step 2 of 11Stacks for Expressions: Infix to postfix
inopsout3+4*(2-1)3✓

'3'. An operand goes straight to the output.

Open in the player →or start at step 2

What you will see

Output row grows; operators stack up and drain by precedence.

How stacks for expressions works →

Cost

BestO(n)
AverageO(n)
WorstO(n)
SpaceO(n)

How you work with it here

play it through, step one change at a time, scrub to any step, run it on your own input, predict what happens next, try operations in any order.

Screen readers: Items announce position from the top or front and value; each step announces the operation and the new top or front.

Reduced motion: Items appear or disappear in place with a crossfade instead of sliding in or out.

Taught by the same lesson

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