Skip to content

Commit f06bc64

Browse files
committed
Added bubble sort algorithm
1 parent 9045a03 commit f06bc64

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

BubbleSort/readme.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Bubble Sort
2+
3+
Bubble sort is a sorting algorithm that is implemented by starting in the beginning of the array and swapping the first two elements only if the first element is greater than the second element. This comparison is then moved onto the next pair and so on and so forth. This is done until the array is completely sorted. The smaller items slowly “bubble” up to the beginning of the array.
4+
5+
##### Runtime:
6+
- Average: O(N^2)
7+
- Worst: O(N^2)
8+
9+
##### Memory:
10+
- O(1)
11+
12+
### Implementation:
13+
14+
The implementation will not be shown as the average and worst runtimes show that this is a very inefficient algorithm. However, having a grasp of the concept will help you understand the basics of simple sorting algorithms.

0 commit comments

Comments
 (0)