partialSort
fn
void partialSort(alias less = "a < b", SwapStrategy ss = SwapStrategy.unstable,
Range)(Range r, size_t n) if (isRandomAccessRange!(Range) && hasLength!(Range) && hasSlicing!(Range))Reorders the random-access range r such that the range r[0 .. mid] is the same as if the entire r were sorted, and leaves the range r[mid .. r.length] in no particular order.
Performs r.length * log(mid) evaluations of pred. The implementation simply calls topN!(less, ss)(r, n) and then sort!(less, ss)(r[0 .. n]).
Parameters
less | The predicate to sort by. |
ss | The swapping strategy to use. |
r | The random-access range to reorder. |
n | The length of the initial segment of r to sort. |
fn
void partialSort(alias less = "a < b", SwapStrategy ss = SwapStrategy.unstable,
Range1, Range2)(Range1 r1, Range2 r2) if (isRandomAccessRange!(Range1) && hasLength!Range1 &&
isInputRange!Range2 && is(ElementType!Range1 == ElementType!Range2) &&
hasLvalueElements!Range1 && hasLvalueElements!Range2)Stores the smallest elements of the two ranges in the left-hand range in sorted order.
Parameters
less | The predicate to sort by. |
ss | The swapping strategy to use. |
r1 | The first range. |
r2 | The second range. |