We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e5f3fcb commit 9961df7Copy full SHA for 9961df7
Sorting/bubble_sort.cpp
@@ -1,3 +1,4 @@
1
+//bubble sort elements
2
# include <iostream>
3
using namespace std;
4
@@ -9,15 +10,15 @@ int main()
9
10
int arr[n];
11
cout<<"Enter the elements of array"<<endl;
12
for (int i = 0; i < n; i++)
- {
13
+ { //array elements input
14
cin>>arr[i];
15
}
16
17
{
18
for (int j= 0; j< n-1; j++)
19
+ { //comparing adjecent elements of array
20
if (arr[j]>arr[j+1])
21
+ { // swaping array elements
22
temp = arr[j];
23
arr[j] = arr[j+1];
24
arr[j+1] = temp;
0 commit comments