Golang常见的十大算法精简版
, index, index + 1) } } Sort(list, left, right - 1) } BucketSort(桶排序) func Sort(list []int) []int{ max := max(list) min := min(list) base := 0 if min < 0 { base = -min } else { base = min } max = (max + base)/10 min = (min + base)/10 bucket := make([][]int, max - min + 1) var result []int for _,value := range list { i := (int)((value+base)/10) bucket[i...阅读全文