#pragma once void ShellSort(int* array, size_t n) { int gap = n; while (gap > 1) { gap = gap/3 + 1; for (size_t i = 0; i < n-gap; ++i) { int end = i; int tmp = array[end+gap]; while ((end >= 0) && array[end] > tmp) { array[end+gap] = array[end]; end -= gap; } array[end+gap] = tmp; } } }