QuicksortRange Sorts the specified range within the array
(arr []T, low, high int)
| 27 | |
| 28 | // QuicksortRange Sorts the specified range within the array |
| 29 | func QuicksortRange[T constraints.Ordered](arr []T, low, high int) { |
| 30 | if len(arr) <= 1 { |
| 31 | return |
| 32 | } |
| 33 | |
| 34 | if low < high { |
| 35 | pivot := Partition(arr, low, high) |
| 36 | QuicksortRange(arr, low, pivot-1) |
| 37 | QuicksortRange(arr, pivot+1, high) |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | // Quicksort Sorts the entire array |
| 42 | func Quicksort[T constraints.Ordered](arr []T) []T { |