public class SortUtil
extends java.lang.Object
Arrays.sort(int[])
. The merge sort is stable, the quick sort is not.Constructor and Description |
---|
SortUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
gsort(java.lang.Object[] a,
java.util.Comparator comp) |
static void |
main(java.lang.String[] args) |
static void |
msort(java.lang.Object[] src,
java.lang.Object[] dest,
java.util.Comparator comp)
Merge sort
|
static void |
msort(java.lang.Object[] src,
java.lang.Object[] dest,
int low,
int high,
java.util.Comparator comp)
Merge sort
|
static void |
qsort(int[] a,
int lo0,
int hi0,
java.util.Comparator comp) |
static void |
qsort(java.lang.Object[] a,
java.util.Comparator comp)
Quick sorts the supplied array using the specified comparator.
|
static void |
qsort(java.lang.Object[] a,
int lo0,
int hi0,
java.util.Comparator comp)
Quick sorts the supplied array using the specified comparator.
|
public static void gsort(java.lang.Object[] a, java.util.Comparator comp)
public static void main(java.lang.String[] args)
public static void qsort(java.lang.Object[] a, java.util.Comparator comp)
public static void qsort(java.lang.Object[] a, int lo0, int hi0, java.util.Comparator comp)
lo0
- the index of the lowest element to include in the sort.hi0
- the index of the highest element to include in the sort.public static void qsort(int[] a, int lo0, int hi0, java.util.Comparator comp)
public static void msort(java.lang.Object[] src, java.lang.Object[] dest, java.util.Comparator comp)
public static void msort(java.lang.Object[] src, java.lang.Object[] dest, int low, int high, java.util.Comparator comp)
src
- Source arraydest
- Destination arraylow
- Index of beginning elementhigh
- Index of end elementcomp
- Comparator