400 028 6601

建站动态

根据您的个性需求进行定制 先人一步 抢占小程序红利时代

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

其他资讯

让你的专属顾问为你服务