MergeSort

com.phasmidsoftware.sort.MergeSort
object MergeSort extends Sort

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.

Attributes

Graph
Supertypes
trait Sort
class Object
trait Matchable
class Any
Self type
MergeSort.type

Members list

Value members

Concrete methods

final def merge[A : Ordering](in: Array[A], out: Array[A], start: Int, mid: Int, end: Int): Unit

Helper method for mergeSort, used to do a single "merge" between two sections of the input array. The start, mid and end parameters denote the left and right ranges of the input to merge, as well as the area of the output to write to.

Helper method for mergeSort, used to do a single "merge" between two sections of the input array. The start, mid and end parameters denote the left and right ranges of the input to merge, as well as the area of the output to write to.

Attributes

final def sort[A : Ordering : ClassTag](data: Array[A]): Unit
final def startStep: Int
final def startWidth: Int