http://kor.i2p/books/The%20C%20Programming%20Language%20by%20K&R/chapter3.html
The interval between compared elements is
gradually decreased to one, at which point the sort effectively becomes an
adjacent interchange method. /* shellsort: sort v[0]...v[n-1] into increasing order */
void shellsort(int v[], int n)
{
int gap, i, j, temp;
for (gap = n/2; gap > 0; gap /= 2)
for (i = gap; i < n; i++)
for (j=i-gap; j>=0 && v[j]>v[j+gap]; j-=gap) {
...