从第一个数开始,判断第一个数和n/2那个数的大小,如果v[0]大于v[n/2]就交换,1与3比较,2与4比较,3与5比较...............
void shell_sort(char *str, int len)
{int group = 0, i = 0, j = 0, temp = 0;if ((NULL == str) || (0 >= len)){return ;}for (group = len / 2; group > 0; group /= 2){for (i = group; i < len; i++){for (j = i - group; j >= 0; j -= group){if (str[j] > str[j + group]){temp = str[j];str[j] = str[j + group];str[j + group] = temp;}}}}
}