From fb2f47b774109e804710974586aaa3a61c7aacae Mon Sep 17 00:00:00 2001 From: radhikaRM06 Date: Mon, 19 Jan 2026 14:43:55 +0530 Subject: [PATCH] Add doctests for duplicate and sorted inputs in bubble sort --- sorts/bubble_sort.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sorts/bubble_sort.py b/sorts/bubble_sort.py index 9ec3d5384f38..b09a2afed928 100644 --- a/sorts/bubble_sort.py +++ b/sorts/bubble_sort.py @@ -17,6 +17,12 @@ def bubble_sort_iterative(collection: list[Any]) -> list[Any]: [-45, -5, -2] >>> bubble_sort_iterative([-23, 0, 6, -4, 34]) [-23, -4, 0, 6, 34] + >>> bubble_sort_iterative([1, 2, 3, 4]) + [1, 2, 3, 4] + >>> bubble_sort_iterative([3, 3, 3, 3]) + [3, 3, 3, 3] + >>> bubble_sort_iterative([56]) + [56] >>> bubble_sort_iterative([0, 5, 2, 3, 2]) == sorted([0, 5, 2, 3, 2]) True >>> bubble_sort_iterative([]) == sorted([])