partialSort

fnvoid 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

lessThe predicate to sort by.
ssThe swapping strategy to use.
rThe random-access range to reorder.
nThe length of the initial segment of r to sort.
fnvoid 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

lessThe predicate to sort by.
ssThe swapping strategy to use.
r1The first range.
r2The second range.