Ilustrasi Minimum Sort (Descending) :
Algoritma Minimum Sort (Descending) :
Contoh Program Minimum Sort (Descending) :
#include<stdio.h>
int main(){
int a[10]={5,1,3,2,4,0,6,7,8,9};
int temp, imin, i, j;
for(i=10;i>2;i--){
imin = i;
for(j=0;j<i;j++){
if(a[j]<a[imin]){
imin = j;
}
}
if(imin != i){
temp = a[i];
a[i] = a[imin];
a[imin] = temp;
}
}
for(j=0;j<10;j++){
printf("%d ",a[j]);
}
return 0;
}
Sumber : http://www.informatikaduniaku.blogspot.com/
0 komentar:
Posting Komentar