edu.rit.util
Class Sorting
- java.lang.Object
-
- edu.rit.util.Sorting
-
public class Sorting extends java.lang.ObjectClass Sorting provides static methods for sorting arrays of primitive types and object types.Note: The operations in class Sorting are not multiple thread safe.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classSorting.ByteClass Sorting.Byte is the base class for a helper object used to sort an array of type byte[].static classSorting.CharacterClass Sorting.Character is the base class for a helper object used to sort an array of type char[].static classSorting.DoubleClass Sorting.Double is the base class for a helper object used to sort an array of type double[].static classSorting.FloatClass Sorting.Float is the base class for a helper object used to sort an array of type float[].static classSorting.IntegerClass Sorting.Integer is the base class for a helper object used to sort an array of type int[].static classSorting.LongClass Sorting.Long is the base class for a helper object used to sort an array of type long[].static classSorting.Object<T>Class Sorting.Object is the abstract base class for a helper object used to sort an array of objects of type T[].static classSorting.ShortClass Sorting.Short is the base class for a helper object used to sort an array of type short[].
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static byte[]sort(byte[] x, Sorting.Byte helper)Sort the given array of type byte[].static char[]sort(char[] x, Sorting.Character helper)Sort the given array of type char[].static double[]sort(double[] x, Sorting.Double helper)Sort the given array of type double[].static float[]sort(float[] x, Sorting.Float helper)Sort the given array of type float[].static int[]sort(int[] x, Sorting.Integer helper)Sort the given array of type int[].static long[]sort(long[] x, Sorting.Long helper)Sort the given array of type long[].static short[]sort(short[] x, Sorting.Short helper)Sort the given array of type short[].static <T> T[]sort(T[] x, Sorting.Object<T> helper)Sort the given object array of type T[].
-
-
-
Method Detail
-
sort
public static byte[] sort(byte[] x, Sorting.Byte helper)Sort the given array of type byte[]. The given helper object is used to determine the desired ordering of the array elements and to swap the array elements. An O(n log n) heapsort algorithm is used.- Parameters:
x- Array to be sorted.helper- Helper object.- Returns:
- The array that was sorted (x).
-
sort
public static char[] sort(char[] x, Sorting.Character helper)Sort the given array of type char[]. The given helper object is used to determine the desired ordering of the array elements and to swap the array elements. An O(n log n) heapsort algorithm is used.- Parameters:
x- Array to be sorted.helper- Helper object.- Returns:
- The array that was sorted (x).
-
sort
public static short[] sort(short[] x, Sorting.Short helper)Sort the given array of type short[]. The given helper object is used to determine the desired ordering of the array elements and to swap the array elements. An O(n log n) heapsort algorithm is used.- Parameters:
x- Array to be sorted.helper- Helper object.- Returns:
- The array that was sorted (x).
-
sort
public static int[] sort(int[] x, Sorting.Integer helper)Sort the given array of type int[]. The given helper object is used to determine the desired ordering of the array elements and to swap the array elements. An O(n log n) heapsort algorithm is used.- Parameters:
x- Array to be sorted.helper- Helper object.- Returns:
- The array that was sorted (x).
-
sort
public static long[] sort(long[] x, Sorting.Long helper)Sort the given array of type long[]. The given helper object is used to determine the desired ordering of the array elements and to swap the array elements. An O(n log n) heapsort algorithm is used.- Parameters:
x- Array to be sorted.helper- Helper object.- Returns:
- The array that was sorted (x).
-
sort
public static float[] sort(float[] x, Sorting.Float helper)Sort the given array of type float[]. The given helper object is used to determine the desired ordering of the array elements and to swap the array elements. An O(n log n) heapsort algorithm is used.- Parameters:
x- Array to be sorted.helper- Helper object.- Returns:
- The array that was sorted (x).
-
sort
public static double[] sort(double[] x, Sorting.Double helper)Sort the given array of type double[]. The given helper object is used to determine the desired ordering of the array elements and to swap the array elements. An O(n log n) heapsort algorithm is used.- Parameters:
x- Array to be sorted.helper- Helper object.- Returns:
- The array that was sorted (x).
-
sort
public static <T> T[] sort(T[] x, Sorting.Object<T> helper)Sort the given object array of type T[]. The given helper object is used to determine the desired ordering of the array elements and to swap the array elements. An O(n log n) heapsort algorithm is used.- Type Parameters:
T- Data type of the array elements.- Parameters:
x- Array to be sorted.helper- Helper object.- Returns:
- The array that was sorted (x).
-
-
DMelt 3.0 © DataMelt by jWork.ORG