希尔排序(Golang)
func shellSort(unsorted []int, n int) { var i, j, gap int var temp int for gap = n/2; gap > 0; gap /= 2 { for i = gap; i < n; i++ { for j = i - gap; j>=0 && unsorted[j]>unsorted[j+gap]; j-=gap { temp = unsourted[j] unsorted[j] = unsorted[j+gap] unsorted[j+gap] = temp } } } }
网站标题:希尔排序(Golang)
标题链接:http://azwzsj.com/article/gcccsj.html