Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sorts/bubble_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading