Select data structure of ordering golang

//SelectSort 选择排序
func SelectSort(arr *[7]int) {
    for i := 0; i < len(arr); i++ {
        tmp := arr[i]
        index := i
        for j := i + 1; j < len(arr); j++ {
            if (*arr)[j] < tmp {
                tmp = (*arr)[j]
                index = j
            }
        }
        if index != i {
            (*arr)[index], (*arr)[i] = (*arr)[i], (*ARR) [index] 
        } 
        fmt.Printf ( " Results after the first choice for% d:% V " , I, * ARR) 
    } 
}

 

 

Guess you like

Origin www.cnblogs.com/xiximayou/p/12017392.html