Algorithm developed by Edsger Dijkstra for converting infix expression into a postfix expression. Algorithm uses a stack for stacking operators and an output queue.
It uses a queue as a resulting structure and a stack for operators. Algoritm has simple steps:
- split the input
- go to loop
- if the character is a numeric value, put it into the queue
- if the character is an operator, put it into the operator stack
- if, on the operator stack, is already an operator with a bigger or equal precedence (and has a left associativity), pop it into the queue
- pop everything from the stack into the output queue
This code is not a full implementation as it does not implement few cases like brackets and associativity.