package Sort
import (
"fmt"
"testing"
)
func SelectSort(array []int) {
if array== nil || len(array)<2 {
return
}
for i:=0;i<len(array);i++ {
for j:=0;j<len(array);j++{
if array[i]<array[j]{
Swap(array,i,j)
}
}
}
}
func TestSelectSort(t *testing.T) {
arr := []int{230, 234, 43, 12, 2, 30,0, 23,230, 234, 43, 12, 2,30,0, 23}
SelectSort(arr)
fmt.Println(arr)
}
06-28
1万+
01-28
2510
01-19
2181
11-06
1880
12-08
1785