1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
package algorithms func lomutoPartition(xs []int, low, high int) int { pivotValue := xs[high] i := low - 1 for j := low; j < high; j++ { if xs[j] <= pivotValue { i++ xs[i], xs[j] = xs[j], xs[i] } } i++ xs[i], xs[high] = xs[high], xs[i] return i }