package mainimport "fmt"func quick (a []int) { for j:=1;j=0 && a[i]>key { a[i+1]=a[i] i=i-1 fmt.Println(a) } a[i+1]=key }}func main () { var array []int = []int{6,1,2,7,9,3,4,11,5,10,8} fmt.Println(array[0]) quick(array)}
本文共 293 字,大约阅读时间需要 1 分钟。
package mainimport "fmt"func quick (a []int) { for j:=1;j=0 && a[i]>key { a[i+1]=a[i] i=i-1 fmt.Println(a) } a[i+1]=key }}func main () { var array []int = []int{6,1,2,7,9,3,4,11,5,10,8} fmt.Println(array[0]) quick(array)}
转载于:https://my.oschina.net/u/3529405/blog/1817216