From 0b5c1b2d785deaa79a1f33c2bacf5d186e4b756b Mon Sep 17 00:00:00 2001 From: PiyushKumar74110 Date: Wed, 10 Jun 2026 23:16:11 +0530 Subject: [PATCH 1/2] Added missing docstrings to helper functions --- sorts/tim_sort.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sorts/tim_sort.py b/sorts/tim_sort.py index 2eeed88b7399..ae66fc152607 100644 --- a/sorts/tim_sort.py +++ b/sorts/tim_sort.py @@ -2,6 +2,10 @@ def binary_search(lst: list[Any], item: Any, start: int, end: int) -> int: + """ + Find the index where an item should be inserted in a sorted list + """ + if start == end: return start if lst[start] > item else start + 1 if start > end: @@ -17,6 +21,10 @@ def binary_search(lst: list[Any], item: Any, start: int, end: int) -> int: def insertion_sort(lst: list[Any]) -> list[Any]: + + """ + Sort a list using insertion sort and binary search + """ length = len(lst) for index in range(1, length): @@ -28,6 +36,10 @@ def insertion_sort(lst: list[Any]) -> list[Any]: def merge(left: list[Any], right: list[Any]) -> list[Any]: + + """ + Merge two sorted lists into one sorted list + """ if not left: return right From f030c6096d0543271df7777e6e65145db98e1f31 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 10 Jun 2026 18:08:33 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- sorts/tim_sort.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/sorts/tim_sort.py b/sorts/tim_sort.py index ae66fc152607..4a3c18b45735 100644 --- a/sorts/tim_sort.py +++ b/sorts/tim_sort.py @@ -21,7 +21,6 @@ def binary_search(lst: list[Any], item: Any, start: int, end: int) -> int: def insertion_sort(lst: list[Any]) -> list[Any]: - """ Sort a list using insertion sort and binary search """ @@ -36,7 +35,6 @@ def insertion_sort(lst: list[Any]) -> list[Any]: def merge(left: list[Any], right: list[Any]) -> list[Any]: - """ Merge two sorted lists into one sorted list """