#include <iostream>
void shellSort(int A[], int n){
int gap, i, j, temp;
for(gap = n/2; gap >= 1; gap /= 2){
for(i = gap; i < n; ++i){
temp = A[i];
j = i - gap;
while(j >= 0 && A[j] > temp){
A[j+gap] = A[j];
j = j - gap;
}
A[j + gap] = temp;
}
}
}
int main()
{
int A[] = {8, 3, 7, 4, 9, 2, 6, 5, 1, 11, 10};
int n = 11;
shellSort(A, n);
for(int i = 0; i < n; ++i){
std::cout<<A[i] << " ";
}
return 0;
}