Skip to content

Instantly share code, notes, and snippets.

@lunaroyster
Created September 23, 2017 05:43
Show Gist options
  • Save lunaroyster/85cf64bff18cbfe430209d51eb99d0b1 to your computer and use it in GitHub Desktop.
Save lunaroyster/85cf64bff18cbfe430209d51eb99d0b1 to your computer and use it in GitHub Desktop.
class Stack:
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
def peek(self):
return self.items[len(self.items)-1]
def size(self):
return len(self.items)
class PostfixResolver:
def resolvePostfixExpression(exp):
stack = Stack()
for(term in exp):
stack.push(term)
print stack.items
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment