Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
selection sort
#include<stdio.h> #include<string.h> void swap(int *x,int *y) { int temp; temp=*x; *x=*y; *y=temp; } void selsort(int arr[],int n) { int i,j,min_index; for(i=0;i<n-1;i++) { min_index=i; for(j=i+1;j<n;j++) if(arr[j]<arr[min_index]) //j=min_index; min_index=j; swap(&arr[min_index],&arr[i]) ; } } void print(int arr[],int size) { int i; for(i=0;i<size;i++) printf("%d\n",arr[i]); } main() { int arr[]={78,90,23,9,40,11,56}; int n; n=sizeof(arr)/sizeof(arr[0]); selsort(arr,n); printf("sorted array\n"); print(arr,n); }
run
|
edit
|
history
|
help
0
Area & Perimeter of Circle
Lab 7 blackjack v1.0
Calculate Area of Circle
C_141204_ValorNumerico
funciones serie de taylor
PART 2
A_141128_MatricesProducto
Lab 9 v0.8
Bitwise Xor Swaping Two Variables
PREGUNTA 2, GUÍA 4, MÓDULO 3 FINALIZADA