From 7b8dd436fe5a5169308c684c41329ff2f8cb72f6 Mon Sep 17 00:00:00 2001 From: ymedrano12 Date: Sun, 15 Nov 2026 23:51:27 -0700 Subject: [PATCH] test: add sorted input doctest for bubble sort --- sorts/bubble_sort.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sorts/bubble_sort.py b/sorts/bubble_sort.py index b1a99f674e00..9f817ad2bda7 100644 --- a/sorts/bubble_sort.py +++ b/sorts/bubble_sort.py @@ -17,6 +17,10 @@ def bubble_sort_iterative[T: Comparable](collection: list[T]) -> list[T]: Time complexity: O(n) best case (already sorted, thanks to the early-exit optimization), O(n^2) average and worst case. + + >>> bubble_sort_iterative([1, 2, 3]) + [1, 2, 3] + Space complexity: O(1) auxiliary (sorts in place). :param collection: some mutable ordered collection with heterogeneous