1.希尔排序
function shellSort(arr) { let length = arr.length; for (let step = length >> 1; step > 0; step = step >> 1) { // step = step >>1 等同于 step = Math.floor(step) for (let i = step; i < length; i++) { for (let j = i; j >= step && arr[j] < arr[j - step]; j -= step) { [arr[j - step], arr[j]] = [arr[j], arr[j - step]]; }; }; }; return arr; };