企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
> 时间复杂度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); } } } } ```