Skip to content

Commit 152ea4b

Browse files
committed
Fix line length issues in docstrings
1 parent d00a6c1 commit 152ea4b

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

sorts/bubble_sort.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33

44
def bubble_sort_iterative(collection: list[Any]) -> list[Any]:
55
"""Pure implementation of bubble sort algorithm in Python.
6-
Bubble sort repeatedly steps through the list, compares adjacent elements, and swaps them
7-
if they are in the wrong order. This process is repeated until the list is sorted.
8-
9-
Time COmplexity:
6+
Bubble sort repeatedly steps through the list, compares adjacent
7+
elements, and swaps them if they are in the wrong order.
8+
This process is repeated until the list is sorted.
9+
10+
Time Complexity:
1011
Worst Case: O(n^2)
1112
Average Case: O(n^2)
12-
Best Case: O(n) (When the list is already sorted and optimized with early stopping)
13+
Best Case: O(n) (When the list is already sorted and
14+
optimized with early stopping)
1315
1416
Space Complexity:
1517
O(1) (in-place sorting)
@@ -75,7 +77,8 @@ def bubble_sort_recursive(collection: list[Any]) -> list[Any]:
7577
Time Complexity:
7678
Worst Case: O(n^2)
7779
Average Case: O(n^2)
78-
Best Case: O(n^2) (no early stopping optimization like iterative version)
80+
Best Case: O(n^2) (no early stopping
81+
optimization like iterative version)
7982
8083
Space Complexity:
8184
O(n) due to recursion stac

0 commit comments

Comments
 (0)