Skip to content

Commit d95a294

Browse files
committed
refa: add docstrings
1 parent e318139 commit d95a294

File tree

1 file changed

+15
-15
lines changed
  • algorithms_and_data_structures/algorithms/sorting/bubble_sort

1 file changed

+15
-15
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
Bubble Sort
2-
==============
1+
# Bubble Sort
32

4-
Repeatedly steps through the list, compares adjacent elements and swaps them if
5-
they are in the wrong order. The pass through the list is repeated until the
6-
list is sorted.
3+
* Repeatedly iterate through the list, one item at a time
4+
* Compare current item with its right neighbor, swap if they are not in order
5+
* Go to next number
6+
* Repeat unit list is ordered
77

8-
Time Complexity
9-
---------------
8+
## Complexity Analysis
9+
10+
### Time Complexity
1011

1112
- Best: `O(n)`
12-
- Worst: `O(n^2)`
1313
- Average: `O(n^2)`
14+
- Worst: `O(n^2)`
1415

15-
Space Complexity
16-
----------------
16+
### Space Complexity
1717

1818
- Total: `O(n)`
1919
- Auxiliary: `O(1)`
2020

21-
Resources
22-
---------
21+
## Resources
2322

24-
- Insertion Sort at Wikipedia: https://en.wikipedia.org/wiki/Bubble_sort
25-
- Insertion Sort at Rosetta Code: https://rosettacode.org/wiki/Sorting_algorithms/Bubble_sort
26-
- Insertion Sort at freeCodeCamp: https://www.freecodecamp.org/news/bubble-sort/
23+
- https://en.wikipedia.org/wiki/Bubble_sort
24+
- https://rosettacode.org/wiki/Sorting_algorithms/Bubble_sort
25+
- https://www.freecodecamp.org/news/bubble-sort/
26+
- https://www.programiz.com/dsa/bubble-sort

0 commit comments

Comments
 (0)