edu.stanford.math.plex4.utility
public static class Quicksort.Int extends java.lang.Object
| Constructor and Description |
|---|
Quicksort.Int() |
| Modifier and Type | Method and Description |
|---|---|
static int |
partition(int[] array,
int startIndex,
int endIndex)
The fundamental partition operation for quicksort.
|
static void |
quicksort(int[] array)
Performs the quicksort algorithm in place on the supplied array.
|
static void |
quicksort(int[] array,
int startIndex,
int endIndex)
Performs the quicksort algorithm in place on a subarray of the
supplied array.
|
static int |
randomizedPartition(int[] array,
int startIndex,
int endIndex)
This function performs the same function as the partition function, except that
it uses a randomly chosen pivot.
|
static void |
randomizedQuicksort(int[] array)
This performs the randomized quicksort algorithm in place on the
supplied array.
|
static void |
randomizedQuicksort(int[] array,
int startIndex,
int endIndex)
This performs the randomized quicksort algorithm in place on a subarray of the
supplied array.
|
static int |
randomizedSelect(int[] array,
int i)
This function returns the i-th order statistic of the data in the supplied array.
|
static int |
randomizedSelect(int[] array,
int startIndex,
int endIndex,
int i)
This function performs the randomizedSelect on a subarray of the supplied array.
|
public static void quicksort(int[] array)
array - the array to sortpublic static void quicksort(int[] array,
int startIndex,
int endIndex)
array - the array to sortstartIndex - the first index of the subarrayendIndex - the last index of the subarraypublic static void randomizedQuicksort(int[] array)
array - public static void randomizedQuicksort(int[] array,
int startIndex,
int endIndex)
array - the array to sortstartIndex - the first index of the subarrayendIndex - the last index of the subarraypublic static int partition(int[] array,
int startIndex,
int endIndex)
array - the array to arrangestartIndex - the first index of the subarrayendIndex - the last index of the subarraypublic static int randomizedPartition(int[] array,
int startIndex,
int endIndex)
array - the array to arrangestartIndex - the first index of the subarrayendIndex - the last index of the subarraypublic static int randomizedSelect(int[] array,
int i)
array - the array to searchi - the rank of the order statistic to findpublic static int randomizedSelect(int[] array,
int startIndex,
int endIndex,
int i)
array[startIndex, ..., endIndex].array - the array to searchstartIndex - the first index of the subarrayendIndex - the last index of the subarrayi - he rank of the order statistic to find