Update infix to postfix (#3817) · zinating/algorithms-python@786b324 · GitHub
Skip to content

Commit 786b324

Browse files
realDuYuanChaogithub-actions
andauthored
Update infix to postfix (TheAlgorithms#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>
1 parent d8f573c commit 786b324

3 files changed

Lines changed: 45 additions & 52 deletions

File tree

DIRECTORY.md

Lines changed: 5 additions & 0 deletions

data_structures/stacks/__init__.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +0,0 @@
1-
class Stack:
2-
def __init__(self):
3-
self.stack = []
4-
self.top = 0
5-
6-
def is_empty(self):
7-
return self.top == 0
8-
9-
def push(self, item):
10-
if self.top < len(self.stack):
11-
self.stack[self.top] = item
12-
else:
13-
self.stack.append(item)
14-
15-
self.top += 1
16-
17-
def pop(self):
18-
if self.is_empty():
19-
return None
20-
else:
21-
self.top -= 1
22-
return self.stack[self.top]

data_structures/stacks/infix_to_postfix_conversion.py

Lines changed: 40 additions & 30 deletions

0 commit comments

Comments
 (0)