|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--com.silentq.sort.InsertionSort
InsertionSort is the simplest sort algorithm. It involves taking one value at a time, and bubbling each of them up from the bottom to the right position in the list. It has linear time performance when the data is sorted already, so it can sometimes perform better than the other sort algorithms. This implementation creates a second Vector, and bubbles each item from the first through the second, improving performance considerably over a standard insertion sort.
| Constructor Summary | |
InsertionSort()
|
|
| Method Summary | |
static byte[] |
sort(byte[] values)
Sorts an array of bytes in place, and returns the array. |
static char[] |
sort(char[] values)
Sorts an array of chars in place, and returns the array. |
static double[] |
sort(double[] values)
Sorts an array of doubles in place, and returns the array. |
static float[] |
sort(float[] values)
Sorts an array of floats in place, and returns the array. |
static java.util.Vector |
sort(java.util.Hashtable values)
Sorts a Hashtable based on the keys. |
static int[] |
sort(int[] values)
Sorts an array of ints in places, and returns the array. |
static long[] |
sort(long[] values)
Sorts an array of longs in place, and returns the array. |
static short[] |
sort(short[] values)
Sorts an array of shorts in place, and returns the array. |
static java.lang.String[] |
sort(java.lang.String[] values)
Sorts an array of Strings in place, and returns the array. |
static java.util.Vector |
sort(java.util.Vector values)
This is the actual insertion sort method. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public InsertionSort()
| Method Detail |
public static int[] sort(int[] values)
values - The int array.public static char[] sort(char[] values)
values - The char array.public static byte[] sort(byte[] values)
values - The byte array.public static short[] sort(short[] values)
values - The short array.public static long[] sort(long[] values)
values - The long array.public static float[] sort(float[] values)
values - The float array.public static double[] sort(double[] values)
values - The double array.public static java.lang.String[] sort(java.lang.String[] values)
values - The String array.public static java.util.Vector sort(java.util.Hashtable values)
values - The Hashtable.public static java.util.Vector sort(java.util.Vector values)
values - The Vector of values to sort.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||