Feature description
The docstrings in sorts/bubble_sort.py are missing time and space complexity information, which is present in many other algorithm implementations across the repository.
Suggested improvement:
Add complexity analysis to the existing docstring:
def bubble_sort(collection: list) -> list:
"""
Bubble Sort Algorithm.
Repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order.
Time Complexity:
- Best Case: O(n) — already sorted
- Average Case: O(n²)
- Worst Case: O(n²)
Space Complexity: O(1) — in-place sorting
Stable: Yes
>>> bubble_sort([4, 3, 2, 1])
[1, 2, 3, 4]
"""
This would make the implementation more educational and consistent with the repository's goal of being a learning resource.
Feature description
The docstrings in sorts/bubble_sort.py are missing time and space complexity information, which is present in many other algorithm implementations across the repository.
Suggested improvement:
Add complexity analysis to the existing docstring:
def bubble_sort(collection: list) -> list:
"""
Bubble Sort Algorithm.
This would make the implementation more educational and consistent with the repository's goal of being a learning resource.