In-place merge sort implementation. This sort is stable but does mutate the given array. It is an in-place sort but it does allocate a temporary array of the same size as the input. It uses InsertionSort for sorting very small arrays.
final def merge[A](in: Array[A], out: Array[A], start: Int, mid: Int, end: Int)(implicit o: Order[A]): Unit
Helper method for mergeSort, used to do a single "merge" between two sections of the input array, and write the result to the output array.
Helper method for mergeSort, used to do a single "merge" between two sections of the input array, and write the result to the output array.
The first input section starts at start (inclusive) and ends at mid (exclusive). The second input section starts at mid (inclusive) and ends at end (exclusive).
Writing to the output begins at start (inclusive).
Type parameters
A
a member of the type class Order
Value parameters
end
the end of the second input section (exclusive)
in
the input array
mid
the end of the first input section (exclusive) and the beginning of the second input section (inclusive)
out
the output array
start
the start of the first input section (inclusive) as well as the start of the merged output
Attributes
final def sort[A : ClassTag](data: Array[A]): Unit
Uses merge sort to sort the array data in place.
Uses merge sort to sort the array data in place.
If the size of the input array does not exceed the threshold startStep, uses insertion sort instead.