package main import ( "fmt" ) var list = []int{1, 55, 3, 6, 4, 95, 23, 57, 2, 8, 5} func QuickSort(list []int) []int { i := list[len(list)-1] left := make([]int, 0) right := make([]int, 0) for j := 0; j < len(list)-1; j++ { if list[j] < i { left = append(left, list[j]) } else { right = append(right, list[j]) } } if len(left) > 1 { QuickSort(left) } if len(right) > 1 { QuickSort(right) } copy(list, left) copy(list[len(left):], []int{i}) copy(list[len(left)+1:], right) return list } func main() { fmt.Println(list) fmt.Println(QuickSort(list)) }