MergeSort
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.
Value members
Concrete methods
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 Params
- A
a member of the type class
Order
- Value Params
- 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