标签:int imp make can func return sprint lang UNC
package main
import (
"fmt"
"strings"
)
func quickSort(l, r int, arry []int) {
if l>=r {
return
}
i,j := l-1,r+1
val := arry[(l+r)/2]
for i<j{
for i++;arry[i]<val;i++ {}
for j--;arry[j]>val;j-- {}
if i<j {
arry[i],arry[j] = arry[j],arry[i]
}
}
quickSort(l,j,arry)
quickSort(j+1,r,arry)
}
func main() {
var n int
fmt.Scanf("%d",&n)
arry:=make([]int,n)
for i:=0;i<n;i++{
fmt.Scanf("%d",&arry[i])
}
quickSort(0, len(arry)-1, arry)
fmt.Println(strings.Trim(fmt.Sprint(arry),"[]"))
}
标签:int imp make can func return sprint lang UNC
原文地址:https://www.cnblogs.com/Tsuki123/p/14387372.html