Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.

Commit b1242a7

Browse files
authored
Merge pull request #8 from m4tveevm/dev
Completing last part of DataStructure task with RB-Tree model
2 parents a3f74d2 + 8eea896 commit b1242a7

28 files changed

+863
-37
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Set up Python
2121
uses: actions/setup-python@v2
2222
with:
23-
python-version: '3.10' # Specify the version of Python you want to use
23+
python-version: '3.10'
2424

2525
- name: Install dependencies
2626
run: |

.idea/etu_algo_labs.iml

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ For a visual demonstration of the algorithm, check out the following video: [Shu
3737
The core implementation is contained within the `Solution` class. Here’s a brief overview of the code:
3838

3939
```python
40-
from algo.Queue import Queue
41-
from algo.Stack import Stack
40+
from src.algo import Queue
41+
from src.algo import Stack
42+
4243

4344
class Solution:
4445
def __init__(self):
@@ -61,7 +62,7 @@ class Solution:
6162
self.__stack.pop()
6263
else:
6364
while self.__stack and self.get_priority(
64-
self.__stack.top.data
65+
self.__stack.top.data
6566
) >= self.get_priority(elem):
6667
self.__queue.push(self.__stack.pop())
6768
self.__stack.push(elem)

pyproject.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[tool.black]
2+
line-length = 79
3+
target-version = ['py37']
4+
include = '\.pyi?$'
5+
exclude = '''
6+
/(
7+
.git
8+
| __pycache__
9+
| docs/source/conf.py
10+
| old
11+
| build
12+
| dist
13+
| .venv
14+
)/
15+
'''

setup.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from setuptools import find_packages, setup
2+
3+
setup(
4+
name="algo_labs",
5+
version="0.1.0",
6+
packages=find_packages(where="src"),
7+
package_dir={"": "src"},
8+
)
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from algo.LineCheck import is_valid
2-
from algo.Queue import Queue
3-
from algo.Stack import Stack
1+
from src.algo.line_check import validate_brackets
2+
from src.algo.queue import Queue
3+
from src.algo.stack import Stack
44

55

66
class Solution:
@@ -13,7 +13,7 @@ def get_priority(elem):
1313
return {"+": 0, "-": 0, "*": 1, "/": 1, "^": 2}.get(elem, -1)
1414

1515
def infix_to_postfix(self, line: str):
16-
assert is_valid(line)
16+
assert validate_brackets(line)
1717
for elem in line.split():
1818
if elem.isnumeric():
1919
self.__queue.push(elem)

src/algo/__init__.py

Whitespace-only changes.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from .Stack import Stack
1+
from src.algo.stack import Stack
22

33

4-
def is_valid(bracket_sequence):
4+
def validate_brackets(bracket_sequence):
55
stack = Stack()
66
brackets_dict = {
77
"[": "]",

0 commit comments

Comments
 (0)