Skip to content

Instantly share code, notes, and snippets.

@Pr3d4dor
Last active August 29, 2015 14:24
Show Gist options
  • Save Pr3d4dor/ffb65f905a92b4c382ce to your computer and use it in GitHub Desktop.
Save Pr3d4dor/ffb65f905a92b4c382ce to your computer and use it in GitHub Desktop.
//Selection sort function in c
void selectionSort(int *vet,int n){
int i,j,min,aux;
for (i=0;i<n-2;i++){
min=i;
for (j=i+1;j<n;j++){
if (vet[j]<vet[min])
min=j;
}
aux=vet[i];
vet[i]=vet[min];
vet[min]=aux;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment