Examples of Stacks and Queues
In Computing and Elsewhere |
Prof. David Bernstein |
Computer Science Department |
bernstdh@jmu.edu |
3 4 * 8 7 3 - / / 4 +
while (moreTokens) { token = nextToken() if (token isa number) { push(token) } else { operand2 = pop() operand1 = pop() result = operand1 token operand2 push(result) } } answer = pop() return answer