mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
Fix
This commit is contained in:
parent
53d22e577d
commit
4c53ee9d75
|
@ -158,7 +158,13 @@ def merge_sort_linked_list(head: Node | None) -> Node | None:
|
|||
|
||||
left = merge_sort_linked_list(head) # Sort left half
|
||||
right = merge_sort_linked_list(next_to_middle) # Sort right half
|
||||
sorted_list = merge(left, right) # Merge sorted halves
|
||||
|
||||
# Merge sorted halves
|
||||
if left is None:
|
||||
return right
|
||||
if right is None:
|
||||
return left
|
||||
sorted_list = merge(left, right)
|
||||
return sorted_list
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user