R
Registered User
What is the name of the following sorting method?
for (i=0; i<n-1; i++)
for (j=i+1; j<n; j++)
if (a>a[j])
swap(&a, &a[j]);
It seems to be the opposite of bubble sort, with lighter elements going
in their proper positions first. However, this one does not compare
a[j] with a[j+1], as the normal bubble sort does.
Looks very simple, and I wonder why I couldn't find it anywhere on the
net!
for (i=0; i<n-1; i++)
for (j=i+1; j<n; j++)
if (a>a[j])
swap(&a, &a[j]);
It seems to be the opposite of bubble sort, with lighter elements going
in their proper positions first. However, this one does not compare
a[j] with a[j+1], as the normal bubble sort does.
Looks very simple, and I wonder why I couldn't find it anywhere on the
net!