#include
#include
#include
void shell_sort(int a[],int size)
{
int i,temp,gap,exch;
gap=size/2;
do{
do{
exch=0;
for(i=0;i
{
temp=a[i];
a[i]=a[i+gap];
a[i+gap]=temp;
exch=1;
}
}while(exch);
}while(gap/=2);
}
int main(void)
{
int *a,i,n;
clrscr();
printf(“\t\t\t\tSHELL SORT\n”);
printf(“\nHow many elements tobe sorted?\n”);
scanf(“%d”,&n);
a=(int *)malloc(n*sizeof(int));
if(!a)
{
printf(“Required space is not created.\n”);
getch();
exit(0);
}
printf(“\nEnter elements into the array.\n”);
for(i=0;iRelated posts: