We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
using namespace std;
int main()
{
int n,temp,b=0;
cin>>n;
int a[n];
for(int i=0;i>a[i];
for(int i=0;ia[j])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
b++;
}
}
cout<<"Array is sorted in "<
for c++
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sorting: Bubble Sort
You are viewing a single comment's thread. Return to all comments →
include
using namespace std; int main() { int n,temp,b=0; cin>>n; int a[n]; for(int i=0;i>a[i]; for(int i=0;ia[j]) { temp=a[i]; a[i]=a[j]; a[j]=temp; b++; } } cout<<"Array is sorted in "<