Added implementations of heap, merge, quich sorts. Built tests.#3
Merged
Added implementations of heap, merge, quich sorts. Built tests.#3
Conversation
aa01a62 to
e094f88
Compare
Godrik0
suggested changes
Dec 8, 2025
Godrik0
left a comment
There was a problem hiding this comment.
Для property based тестов можно использовать библиотеку hypothesis, она сама генерирует крайние случаи. А так всё круто!
src/tests_pytest_6/quick_sort.py
Outdated
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 |
There was a problem hiding this comment.
Не очень понимаю зачем тут эта функция, кажется Вы забыли удалить
Забыла изначально удалить функцию merge_sort
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ради интереса реализован тест через параметризацию.
Merge sort и Quick sort реализованы как самые полезные в будущем.