Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sorts/tim_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ def tim_sort(lst: list[Any] | tuple[Any, ...] | str) -> list[Any]:
True
>>> tim_sort([3, 2, 1]) == sorted([3, 2, 1])
True
>>> tim_sort([])
[]
"""
length = len(lst)
if length == 0:
return []
runs, sorted_runs = [], []
new_run = [lst[0]]
sorted_array: list[Any] = []
Expand Down