💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
> 时间复杂度O(n^1.25),辅助空间O(1),不稳定 ```java public static <T extends Comparable> void shellSort(T[] a) { int len = a.length; int h = 1; while (h < len / 3) { h = 3 * h + 1; } for (; h >= 1; h /= 3) { for (int i = h; i < len; i++) { for (int j = i; j >= h && less(a[j], a[j - h]); j -= h) { swap(a, j, j - h); } } } } ```