mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-12-18 01:00:15 +00:00
fix: use +=
in sorts/recursive_mergesort_array.py (#5019)
This commit is contained in:
parent
cb4dc19723
commit
31061aacf2
|
@ -38,23 +38,23 @@ def merge(arr: list[int]) -> list[int]:
|
||||||
): # Runs until the lowers size of the left and right are sorted.
|
): # Runs until the lowers size of the left and right are sorted.
|
||||||
if left_array[left_index] < right_array[right_index]:
|
if left_array[left_index] < right_array[right_index]:
|
||||||
arr[index] = left_array[left_index]
|
arr[index] = left_array[left_index]
|
||||||
left_index = left_index + 1
|
left_index += 1
|
||||||
else:
|
else:
|
||||||
arr[index] = right_array[right_index]
|
arr[index] = right_array[right_index]
|
||||||
right_index = right_index + 1
|
right_index += 1
|
||||||
index = index + 1
|
index += 1
|
||||||
while (
|
while (
|
||||||
left_index < left_size
|
left_index < left_size
|
||||||
): # Adds the left over elements in the left half of the array
|
): # Adds the left over elements in the left half of the array
|
||||||
arr[index] = left_array[left_index]
|
arr[index] = left_array[left_index]
|
||||||
left_index = left_index + 1
|
left_index += 1
|
||||||
index = index + 1
|
index += 1
|
||||||
while (
|
while (
|
||||||
right_index < right_size
|
right_index < right_size
|
||||||
): # Adds the left over elements in the right half of the array
|
): # Adds the left over elements in the right half of the array
|
||||||
arr[index] = right_array[right_index]
|
arr[index] = right_array[right_index]
|
||||||
right_index = right_index + 1
|
right_index += 1
|
||||||
index = index + 1
|
index += 1
|
||||||
return arr
|
return arr
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user