Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
selection sort
//gcc 5.4.0 #include <stdio.h> #include <stdlib.h> int min(int a[],int N,int k)//this function is used to find minimum value in the array {int MIN,loc,j; MIN=a[k]; loc=k; for(int j=k+1;j<=N-1;j++) if(MIN>a[j]){ MIN=a[j];//setting minimum value to current index loc=j; } return(loc); } int main() { int a[]={34,74,73,83,24,46,82,91,12,56}, temp,k,loc; for(k=0;k<9;k++) { loc=min(a,10,k);//return location of minimum value temp=a[k]; a[k]=a[loc]; a[loc]=temp; } for(k=0;k<9;k++) printf("%d\n",a[k]); }
run
|
edit
|
history
|
help
1
Working except for the thread part. LUL
printf
etapa final de pregunta 2
holiwis
B_14118_RestasSucesivas
B_141125_Burbuja
part 3
hwkpractice
FileCat
Project 3 Part 1 v1.2