Update infix to postfix (#3817)

* add test to infix_to_postfix_conversion

* fixed pre-commit error

* fixed build error

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
Du Yuanchao
2020-11-02 00:35:31 +08:00
committed by GitHub
parent d8f573c0fb
commit 786b32431c
3 changed files with 45 additions and 52 deletions

View File

@ -1,22 +0,0 @@
class Stack:
def __init__(self):
self.stack = []
self.top = 0
def is_empty(self):
return self.top == 0
def push(self, item):
if self.top < len(self.stack):
self.stack[self.top] = item
else:
self.stack.append(item)
self.top += 1
def pop(self):
if self.is_empty():
return None
else:
self.top -= 1
return self.stack[self.top]