edu.stanford.math.plex4.utility
public static class Quicksort.GenericList<T> extends java.lang.Object
Constructor and Description |
---|
Quicksort.GenericList() |
Modifier and Type | Method and Description |
---|---|
static <T> int |
partition(java.util.List<T> array,
int startIndex,
int endIndex,
java.util.Comparator<T> comparator) |
static <T> void |
quicksort(java.util.List<T> array,
java.util.Comparator<T> comparator) |
static <T> void |
quicksort(java.util.List<T> array,
int startIndex,
int endIndex,
java.util.Comparator<T> comparator) |
static <T> int |
randomizedPartition(java.util.List<T> array,
int startIndex,
int endIndex,
java.util.Comparator<T> comparator) |
static <T> void |
randomizedQuicksort(java.util.List<T> array,
java.util.Comparator<T> comparator)
This performs the randomized quicksort algorithm in place on the
supplied array.
|
static <T> void |
randomizedQuicksort(java.util.List<T> array,
int startIndex,
int endIndex,
java.util.Comparator<T> comparator)
This performs the randomized quicksort algorithm in place on a subarray of the
supplied array.
|
static <T> T |
randomizedSelect(java.util.List<T> array,
int i,
java.util.Comparator<T> comparator) |
static <T> T |
randomizedSelect(java.util.List<T> array,
int startIndex,
int endIndex,
int i,
java.util.Comparator<T> comparator) |
public static <T> void quicksort(java.util.List<T> array, java.util.Comparator<T> comparator)
public static <T> void quicksort(java.util.List<T> array, int startIndex, int endIndex, java.util.Comparator<T> comparator)
public static <T> void randomizedQuicksort(java.util.List<T> array, java.util.Comparator<T> comparator)
array
- public static <T> void randomizedQuicksort(java.util.List<T> array, int startIndex, int endIndex, java.util.Comparator<T> comparator)
array
- the array to sortstartIndex
- the first index of the subarrayendIndex
- the last index of the subarraypublic static <T> int partition(java.util.List<T> array, int startIndex, int endIndex, java.util.Comparator<T> comparator)
public static <T> int randomizedPartition(java.util.List<T> array, int startIndex, int endIndex, java.util.Comparator<T> comparator)
public static <T> T randomizedSelect(java.util.List<T> array, int i, java.util.Comparator<T> comparator)
public static <T> T randomizedSelect(java.util.List<T> array, int startIndex, int endIndex, int i, java.util.Comparator<T> comparator)