C++实现希尔排序
#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; } } }
当前名称:C++实现希尔排序
标题URL:http://cdiso.cn/article/jsppjs.html