Skip to content

Instantly share code, notes, and snippets.

@vijfhoek
Created March 27, 2015 00:18
Show Gist options
  • Save vijfhoek/a4ddf24f5811e05a84f6 to your computer and use it in GitHub Desktop.
Save vijfhoek/a4ddf24f5811e05a84f6 to your computer and use it in GitHub Desktop.
[vijfhoek@sijmen-laptop Algorithms]$ python shuntingyard.py 1
['1']
[vijfhoek@sijmen-laptop Algorithms]$ python shuntingyard.py 1+5
['1', '5', '+']
[vijfhoek@sijmen-laptop Algorithms]$ python shuntingyard.py 1+5*3
['1', '5', '3', '*', '+']
[vijfhoek@sijmen-laptop Algorithms]$ python shuntingyard.py 1*5+3
['1', '5', '*', '3', '+']
[vijfhoek@sijmen-laptop Algorithms]$ python shuntingyard.py 3X+5
['3', 'X', '*', '5', '+']
[vijfhoek@sijmen-laptop Algorithms]$ python shuntingyard.py 3X^2+5X-2
['3', 'X', '2', '^', '*', '5', 'X', '*', '+', '2', '-']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment