We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 38f0c70 commit b0e537cCopy full SHA for b0e537c
1 file changed
bubbleSort
@@ -0,0 +1,20 @@
1
+#include <bits/stdc++.h>
2
+using namespace std;
3
+void bubbleSort(int arr[], int n){
4
+ for(int i=0;i<n-1;i++){
5
+ for(int j=0;j<n-1-i;j++){
6
+ if(arr[j]>arr[j+1]){
7
+ swap(arr[j],arr[j+1]);
8
+ }
9
10
11
+}
12
+int main()
13
+{
14
+ int a[]={3,2,5,6,4};
15
+ int m=sizeof(a)/sizeof(a[0]);
16
+ bubbleSort(a, m);
17
+ for(int i=0;i<m;i++){
18
+ cout<<a[i]<<" ";
19
20
0 commit comments