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 number Diff line number Diff line change 1
- Bubble Sort
2
- ==============
1
+ # Bubble Sort
3
2
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
7
7
8
- Time Complexity
9
- ---------------
8
+ ## Complexity Analysis
9
+
10
+ ### Time Complexity
10
11
11
12
- Best: ` O(n) `
12
- - Worst: ` O(n^2) `
13
13
- Average: ` O(n^2) `
14
+ - Worst: ` O(n^2) `
14
15
15
- Space Complexity
16
- ----------------
16
+ ### Space Complexity
17
17
18
18
- Total: ` O(n) `
19
19
- Auxiliary: ` O(1) `
20
20
21
- Resources
22
- ---------
21
+ ## Resources
23
22
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
You can’t perform that action at this time.
0 commit comments