清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
package main import ( "fmt" ) func main() { A := []int{5, 21, 2, 4, 1} num := len(A) for i := 0; i < num; i++ { for j := i + 1; j < num; j++ { if A[i] > A[j] { A[i], A[j] = A[j], A[i] } } } fmt.Println(A) }
2015/07/24 52412
清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
package main import ( "fmt" ) func main() { A := []int{5, 21, 2, 4, 1} num := len(A) for i := 0; i < num; i++ { for j := i + 1; j < num; j++ { if A[i] > A[j] { A[i], A[j] = A[j], A[i] } } } fmt.Println(A) }