The predicate to sort by.
The swapping strategy to use.
The sorted, left-hand side of the random access range to be sorted.
The unsorted, right-hand side of the random access range to be sorted.
import std.range : assumeSorted; int[] a = [ 1, 2, 3 ]; int[] b = [ 4, 0, 6, 5 ]; completeSort(assumeSorted(a), b); assert(a == [ 0, 1, 2 ]); assert(b == [ 3, 4, 5, 6 ]);
Sorts the random-access range chain(lhs, rhs) according to predicate less.
The left-hand side of the range lhs is assumed to be already sorted; rhs is assumed to be unsorted. The exact strategy chosen depends on the relative sizes of lhs and rhs. Performs O(lhs.length + rhs.length * log(rhs.length)) (best case) to O((lhs.length + rhs.length) * log(lhs.length + rhs.length)) (worst-case) evaluations of swap.