insertionSortRuns runs insertion sort on all the data runs one by one.
(data []T, runSize int)
| 34 | |
| 35 | // insertionSortRuns runs insertion sort on all the data runs one by one. |
| 36 | func insertionSortRuns[T constraints.Ordered](data []T, runSize int) { |
| 37 | for lower := 0; lower < len(data); lower += runSize { |
| 38 | upper := lower + runSize |
| 39 | if upper >= len(data) { |
| 40 | upper = len(data) |
| 41 | } |
| 42 | |
| 43 | Insertion(data[lower:upper]) |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | // mergeRuns merge sorts all the data runs into a single sorted data slice. |
| 48 | func mergeRuns[T constraints.Ordered](data []T, runSize int) { |