Skip to content

Commit b17141a

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 4a0f090 commit b17141a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sorts/adaptive_merge_sort.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
def adaptive_merge_sort(sequence: list) -> list:
22
"""
33
Sorts a list using the Adaptive Merge Sort algorithm.
4-
4+
55
>>> adaptive_merge_sort([4, 3, 1, 2])
66
Initial sequence: [4, 3, 1, 2]
77
Sorting: array[0:2] and array[2:4]
@@ -22,10 +22,11 @@ def adaptive_merge_sort(sequence: list) -> list:
2222
print(f"Sorted sequence: {sequence}")
2323
return sequence
2424

25+
2526
def adaptive_merge_sort_helper(array: list, aux: list, low: int, high: int) -> None:
2627
"""
2728
Helper function for Adaptive Merge Sort algorithm.
28-
29+
2930
>>> adaptive_merge_sort_helper([4, 3, 1, 2], [4, 3, 1, 2], 0, 3)
3031
Sorting: array[0:2] and array[2:4]
3132
Sorting: array[0:1] and array[1:2]
@@ -47,6 +48,7 @@ def adaptive_merge_sort_helper(array: list, aux: list, low: int, high: int) -> N
4748
return
4849
merge(array, aux, low, mid, high)
4950

51+
5052
def merge(array: list, aux: list, low: int, mid: int, high: int) -> None:
5153
"""
5254
Merges two sorted subarrays of the main array.

0 commit comments

Comments
 (0)