Package com.complexible.common.base
Class Sorter.QuickSorter<T>
java.lang.Object
com.complexible.common.base.Sorter<T>
com.complexible.common.base.Sorter.QuickSorter<T>
Sorter implementation for QuickSort. This is basically a fork of the mahout, in-place quick-sort with a couple
minor modifications
-
Nested Class Summary
Nested classes/interfaces inherited from class com.complexible.common.base.Sorter
Sorter.QuickSorter<T> -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Comparable<? super T>>
voidquickSort(T[] array, int start, int end) Sort the specified range of an array of object that implement the Comparable interface.static <T> voidquickSort(T[] array, int start, int end, Comparator<T> comp) Sorts the specified range in the array in a specified order.void
-
Constructor Details
-
QuickSorter
-
-
Method Details
-
sort
-
quickSort
Sorts the specified range in the array in a specified order.- Parameters:
array- the array to be sorted.start- the start index to sort.end- the last + 1 index to sort.comp- the comparator.- Throws:
IllegalArgumentException- ifstart > end.ArrayIndexOutOfBoundsException- ifstart < 0orend > array.length.
-
quickSort
Sort the specified range of an array of object that implement the Comparable interface.- Type Parameters:
T- The type of object.- Parameters:
array- the array.start- the first index.end- the last index (exclusive).
-