answersLogoWhite

0

void bubble_sort (int a[], unsigned s)

{

/* sort array a of s elements */

int i, n;

n=s;

do

{

for (i=1; i<s; ++i)

{

if (a[i]<a[i-1])

{

/* swap */

int t = a[i];

a[i] = a[i-1];

a[i-1]=t;

n=i;

}

}

s=n;

} while (s!=0);

}

User Avatar

Wiki User

11y ago

What else can I help you with?