From 281076d6efba519dd034a6c1aa39d522747ba56e Mon Sep 17 00:00:00 2001 From: deepshekhardas Date: Mon, 31 Aug 2026 12:35:12 +0530 Subject: [PATCH] docs(sorts): add complexity analysis to insertion_sort docstring --- sorts/insertion_sort.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sorts/insertion_sort.py b/sorts/insertion_sort.py index 2e39be255df7..31828aa7229f 100644 --- a/sorts/insertion_sort.py +++ b/sorts/insertion_sort.py @@ -27,6 +27,9 @@ def __lt__(self, other: Any, /) -> bool: ... def insertion_sort[T: Comparable](collection: MutableSequence[T]) -> MutableSequence[T]: """A pure Python implementation of the insertion sort algorithm + Time Complexity: O(n^2) worst case, O(n) best case (already sorted) + Space Complexity: O(1) auxiliary + :param collection: some mutable ordered collection with heterogeneous comparable items inside :return: the same collection ordered by ascending