#include< iostream >
#include < ctime >
using namespace std;
void shellSort(int a[], int n)
{
int i,j,gap;
for (gap = n / 2; gap > 0; gap /= 2)
{
for (i = 0 ;i < gap; i++)
{
for (j = i + gap; j < n; j += gap)
{
if (a[j] < a[j - gap])
{
int tmp = a[j];
int k = j - gap;
while (k >= 0 && a[k] > tmp)
{
a[k + gap] = a[k];
k -= gap;
}
a[k + gap] = tmp;
}
}
}
}
}
int main()
{
int a[100000];
srand((unsigned)time(NULL));
for(int i=0;i<100000;i++)
{
a[i]=(rand() % (100000+1));
}
shellSort(a,100000);
return 0;
}