Skip to content

Added implementations of heap, merge, quich sorts. Built tests.#3

Merged
cutenti merged 2 commits intomainfrom
6_Pytest_and_tests
Dec 8, 2025
Merged

Added implementations of heap, merge, quich sorts. Built tests.#3
cutenti merged 2 commits intomainfrom
6_Pytest_and_tests

Conversation

@cutenti
Copy link
Owner

@cutenti cutenti commented Dec 7, 2025

Ради интереса реализован тест через параметризацию.
Merge sort и Quick sort реализованы как самые полезные в будущем.

@cutenti cutenti force-pushed the 6_Pytest_and_tests branch from aa01a62 to e094f88 Compare December 7, 2025 21:29
Copy link

@Godrik0 Godrik0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Для property based тестов можно использовать библиотеку hypothesis, она сама генерирует крайние случаи. А так всё круто!

Comment on lines 36 to 65
def merge_sort(arr):
if len(arr) > 1:
mid = len(arr) // 2
left = arr[:mid]
right = arr[mid:]

merge_sort(left)
merge_sort(right)

i = j = k = 0

while i < len(left) and j < len(right):
if left[i] < right[j]:
arr[k] = left[i]
i += 1
else:
arr[k] = right[j]
j += 1
k += 1

while i < len(left):
arr[k] = left[i]
i += 1
k += 1

while j < len(right):
arr[k] = right[j]
j += 1
k += 1
return arr
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не очень понимаю зачем тут эта функция, кажется Вы забыли удалить

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Исправлено! не заметила

Забыла изначально удалить функцию merge_sort
@cutenti cutenti merged commit 49fb110 into main Dec 8, 2025
1 check passed
@cutenti cutenti deleted the 6_Pytest_and_tests branch December 13, 2025 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants