Skip to content

Commit 90f7ac3

Browse files
committed
fix(sorts): respect less-than-only iterative merge items
1 parent 574d100 commit 90f7ac3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎sorts/iterative_merge_sort.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def merge[T: Comparable](input_list: list[T], low: int, mid: int, high: int) ->
2626
result: list[T] = []
2727
left, right = input_list[low:mid], input_list[mid : high + 1]
2828
while left and right:
29-
result.append((left if left[0] <= right[0] else right).pop(0))
29+
result.append((right if right[0] < left[0] else left).pop(0))
3030
input_list[low : high + 1] = result + left + right
3131
return input_list
3232

0 commit comments

Comments
 (0)