diff --git a/C/selectionSort.c b/C/selectionSort.c new file mode 100644 index 0000000..479f4fc --- /dev/null +++ b/C/selectionSort.c @@ -0,0 +1,38 @@ +#include +int find(int *ar,int left,int right) +{ + int index=left,j,min=ar[left];; + for (j = left+1; j <=right; j++) + if (ar[j] < ar[index]) + index = j; + + return index; +} +void swap(int *a,int *b) +{ + int temp=*a; + *a=*b; + *b=temp; +} +void selection_sort(int *ar,int size) +{ + int p,s,pos; + for(p=0;p