quick_sort - GreenFaith/algorithms GitHub Wiki
use intArray or strArray to define []int or []string.
You can use them simply like this:
x := intArray {1,2,3,1}
QuickSort(x, 0, x.Len()-1)
y := strArray {'hello', 'go', 'algorithms'}
QuickSort(y, 0, y.Len()-1)
Both intArray and strArray implements interface Ord
type Ord interface {
Swap(i, j int)
Less(i,j int) bool
Len() int
}
You can implements Ord interface to make your own type sortable.
About 700ms for sort 1,000,000 random number
