Computer Science, asked by shrimantra8559, 1 year ago

How is bubble sort algorithm diifferent from modified bubble sort algorithm?

Answers

Answered by yim64718
2

void bubble(int a[], int n){

for(int i=0; i<n; i++){

int swaps=0;

for(int j=0; j<n-i-1; j++){

if(a[j]>a[j+1]){

int t=a[j];

a[j]=a[j+1];

a[j+1]=t;  

swaps++;

}

}

if(swaps==0)

break;

}

}

brailliant kar de

Similar questions