希尔排序(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://scyanting.com/article/gcccsj.html