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
Bitwise Operations
Project 3 part 2 Book v0.5
B_141104_TresPuntosTriangulo
Switch
with goto, with j++
141124_PI
SEGUNDO AVANCE DE NETFLIX
Poiter minus
scanf and integer manipulation
lab9tho