jsat.utils
Class QuickSort
- java.lang.Object
-
- jsat.utils.QuickSort
-
public class QuickSort extends java.lang.ObjectProvides implementations of quicksort. This is for use to obtain explicitly desired behavior, as well as aovid overhead by explicitly allowing extra Lists when sorting that are swapped when the array/list being sorted is swapped.
This class exist solely for performance reasons.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static voidinsertionSort(double[] x, int start, int end)static voidsort(double[] x, int start, int end)Performs sorting based on the double values natural comparator.static voidsort(double[] x, int start, int end, java.util.Collection<java.util.List<?>> paired)Performs sorting based on the double values natural comparator.static voidsort(float[] x, int start, int end, java.util.Collection<java.util.List<?>> paired)Performs sorting based on the double values natural comparator.static voidswap(double[] array, int i, int j)static voidswap(double[] array, int i, int j, java.util.Collection<java.util.List<?>> paired)static voidswap(float[] array, int i, int j)static voidswap(float[] array, int i, int j, java.util.Collection<java.util.List<?>> paired)static voidswapC(double[] array, int i, int j)Conditional swap, only swaps the values if array[i] > array[j]
-
-
-
Method Detail
-
swap
public static void swap(double[] array, int i, int j)
-
swap
public static void swap(float[] array, int i, int j)
-
swapC
public static void swapC(double[] array, int i, int j)Conditional swap, only swaps the values if array[i] > array[j]- Parameters:
array- the array to potentially swap values ini- the 1st indexj- the 2nd index
-
swap
public static void swap(double[] array, int i, int j, java.util.Collection<java.util.List<?>> paired)- Parameters:
array- the array to swap values ini- the 1st indexj- the 2nd indexpaired- a collection of lists, every list will have its indices swapped as well
-
swap
public static void swap(float[] array, int i, int j, java.util.Collection<java.util.List<?>> paired)- Parameters:
array- the array to swap values ini- the 1st indexj- the 2nd indexpaired- a collection of lists, every list will have its indices swapped as well
-
sort
public static void sort(double[] x, int start, int end)Performs sorting based on the double values natural comparator.Double.NaNvalues will not be handled appropriately.- Parameters:
x- the array to sortstart- the starting index (inclusive) to sortend- the ending index (exclusive) to sort
-
insertionSort
public static void insertionSort(double[] x, int start, int end)- Parameters:
x-start- inclusiveend- exclusive
-
sort
public static void sort(double[] x, int start, int end, java.util.Collection<java.util.List<?>> paired)Performs sorting based on the double values natural comparator.Double.NaNvalues will not be handled appropriately.- Parameters:
x- the array to sortstart- the starting index (inclusive) to sortend- the ending index (exclusive) to sortpaired- a collection of lists, every list will have its indices swapped as well
-
sort
public static void sort(float[] x, int start, int end, java.util.Collection<java.util.List<?>> paired)Performs sorting based on the double values natural comparator.Double.NaNvalues will not be handled appropriately.- Parameters:
x- the array to sortstart- the starting index (inclusive) to sortend- the ending index (exclusive) to sortpaired- a collection of lists, every list will have its indices swapped as well
-
-
DataMelt 3.0 © DataMelt by jWork.ORG