Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed build error
  • Loading branch information
realDuYuanChao committed Oct 29, 2020
commit 6c919f299e8c710496ef43a86178bfef28701975
22 changes: 0 additions & 22 deletions data_structures/stacks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,22 +0,0 @@
class Stack:
Comment thread
poyea marked this conversation as resolved.
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]
4 changes: 2 additions & 2 deletions data_structures/stacks/infix_to_postfix_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
https://en.wikipedia.org/wiki/Shunting-yard_algorithm
"""

from stacks.balanced_parentheses import balanced_parentheses
from stacks.stack import Stack
from .balanced_parentheses import balanced_parentheses
from .stack import Stack


def precedence(char: str) -> int:
Expand Down