We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ff3d7f8 + 22d122f commit d403700Copy full SHA for d403700
Sorts/BubbleSort.js
@@ -0,0 +1,14 @@
1
+export default BubbleSort = function(arr) {
2
+ n = arr.length;
3
+ sorted_arr = arr
4
+
5
+ for(let i = 0; i < n; i++){
6
+ for(let j = 0; j < n-i-1; j++){
7
+ if(sorted_arr[j] > sorted_arr[i]){
8
+ let tmp = sorted_arr[j];
9
+ sorted_arr[j] = sorted_arr[i];
10
+ sorted_arr[i] = tmp;
11
+ }
12
13
14
+}
0 commit comments