diff --git a/Shell_Sort b/Shell_Sort new file mode 100644 index 0000000..13642b5 --- /dev/null +++ b/Shell_Sort @@ -0,0 +1,41 @@ +#include +#include +void swap(int *x,int *y) +{ + int temp=*x; + *x=*y; + *y=temp; +} +void ShellSort(int A[],int n) +{ + int gap,i,j,temp; + + for(gap=n/2;gap>=1;gap/=2) + { + for(i=gap;i=0 && A[j]>temp) + { + A[j+gap]=A[j]; + j=j-gap; + } + A[j+gap]=temp; + + } + } + +} +int main() +{ + int A[]={11,13,7,12,16,9,24,5,10,3},n=10,i; + + SellSort(A,n); + + for(i=0;i<10;i++) + printf("%d ",A[i]); + printf("\n"); + + return 0; +}