QuickSort
In-place quicksort implementation. It is not stable, but does not allocate extra space (other than stack). Like MergeSort, it uses InsertionSort for sorting very small arrays.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
QuickSort.type
Members list
Value members
Concrete methods
Method to partition a sub-array into the smaller elements, the pivot itself, and the larger elements.
Method to partition a sub-array into the smaller elements, the pivot itself, and the larger elements.
Type parameters
- A
-
the type of the elements of data.
Value parameters
- data
-
an array of elements of type A -- the array will be mutated.
- from
-
the first index of the sub-array to be sorted.
- pivot
-
the index of the pivot element to be used as the pivot (arbitrary).
- to
-
the first index of the sub-array NOT to be sorted.
Attributes
- Returns
-
the index at which we will now find the pivot.
Mutating method to sort a sub-array of the data array.
Mutating method to sort a sub-array of the data array.
Type parameters
- A
-
the type of the elements of data.
Value parameters
- data
-
an array of elements of type A -- the array will be mutated.
- from
-
the first index of the sub-array to be sorted.
- to
-
the first index of the sub-array NOT to be sorted.
Attributes
Mutating method to sort the data array.
Mutating method to sort the data array.
Type parameters
- A
-
the type of the elements of data.
Value parameters
- data
-
an array of elements of type A -- the array will be mutated.