|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectprea.util.Sort
public class Sort
This is a class implementing sort functions in various data type.
| Constructor Summary | |
|---|---|
Sort()
|
|
| Method Summary | |
|---|---|
static void |
kLargest(double[] array1,
int[] array2,
int first,
int last,
int k)
Return k largest elements (sorted) and their indices from a given array. |
static void |
kSmallest(double[] array1,
int[] array2,
int first,
int last,
int k)
Return k smallest elements (sorted) and their indices from a given array. |
private static int |
partition(double[] array1,
int[] array2,
int first,
int last,
boolean increasingOrder)
Partition the given array into two section: smaller and larger than threshold. |
private static int |
partition(int[] array1,
double[] array2,
int first,
int last,
boolean increasingOrder)
Partition the given array into two section: smaller and larger than threshold. |
private static int |
partition(int[] array1,
int[] array2,
int first,
int last,
boolean increasingOrder)
Partition the given array into two section: smaller and larger than threshold. |
private static int |
partition(int[] array,
int first,
int last,
boolean increasingOrder)
Partition the given array into two section: smaller and larger than threshold. |
static void |
quickSort(double[] array1,
int[] array2,
int first,
int last,
boolean increasingOrder)
Sort the given array, and returns original index as well. |
static void |
quickSort(int[] array1,
double[] array2,
int first,
int last,
boolean increasingOrder)
Sort the given array, and returns original index as well. |
static void |
quickSort(int[] array1,
int[] array2,
int first,
int last,
boolean increasingOrder)
Sort the given array, and returns original index as well. |
static void |
quickSort(int[] array,
int first,
int last,
boolean increasingOrder)
Sort the given array. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Sort()
| Method Detail |
|---|
public static void kLargest(double[] array1,
int[] array2,
int first,
int last,
int k)
array1 - original array of data elementsarray2 - original array containing data indexfirst - the first element in the array. Use 0 to deal with the whole array.last - the last element in the array. Use the maximum index of the array to deal with the whole array.k - the number of items
public static void kSmallest(double[] array1,
int[] array2,
int first,
int last,
int k)
array1 - original array of data elementsarray2 - original array containing data indexfirst - the first element in the array. Use 0 to deal with the whole array.last - the last element in the array. Use the maximum index of the array to deal with the whole array.k - the number of items
public static void quickSort(int[] array,
int first,
int last,
boolean increasingOrder)
array - original array of data elementsfirst - the first element to be sorted in the array. Use 0 for sorting the whole array.last - the last element to be sorted in the array. Use the maximum index of the array for sorting the whole array.increasingOrder - indicating the sort is in increasing order. Use true for increasing order, false for decreasing order.
public static void quickSort(double[] array1,
int[] array2,
int first,
int last,
boolean increasingOrder)
array1 - original array of data elementsarray2 - original array containing data indexfirst - the first element to be sorted in the array. Use 0 for sorting the whole array.last - the last element to be sorted in the array. Use the maximum index of the array for sorting the whole array.increasingOrder - indicating the sort is in increasing order. Use true for increasing order, false for decreasing order.
public static void quickSort(int[] array1,
int[] array2,
int first,
int last,
boolean increasingOrder)
array1 - original array of data elements of type intarray2 - original array containing data indexfirst - the first element to be sorted in the array. Use 0 for sorting the whole array.last - the last element to be sorted in the array. Use the maximum index of the array for sorting the whole array.increasingOrder - indicating the sort is in increasing order. Use true for increasing order, false for decreasing order.
public static void quickSort(int[] array1,
double[] array2,
int first,
int last,
boolean increasingOrder)
array1 - original array of data elements of type intarray2 - original array containing data of type doublefirst - the first element to be sorted in the array. Use 0 for sorting the whole array.last - the last element to be sorted in the array. Use the maximum index of the array for sorting the whole array.increasingOrder - indicating the sort is in increasing order. Use true for increasing order, false for decreasing order.
private static int partition(int[] array,
int first,
int last,
boolean increasingOrder)
array - original array of data elementsfirst - the first element in the arraylast - the last element in the arrayincreasingOrder - indicating the sort is in increasing order. Use true for increasing order, false for decreasing order.
private static int partition(double[] array1,
int[] array2,
int first,
int last,
boolean increasingOrder)
array1 - original array of data elementsarray2 - original array containing data indexfirst - the first element in the arraylast - the last element in the arrayincreasingOrder - indicating the sort is in increasing order. Use true for increasing order, false for decreasing order.
private static int partition(int[] array1,
int[] array2,
int first,
int last,
boolean increasingOrder)
array1 - original array of data elements of type intarray2 - original array containing data indexfirst - the first element in the arraylast - the last element in the arrayincreasingOrder - indicating the sort is in increasing order. Use true for increasing order, false for decreasing order.
private static int partition(int[] array1,
double[] array2,
int first,
int last,
boolean increasingOrder)
array1 - original array of data elements of type intarray2 - original array containing data of type doublefirst - the first element in the arraylast - the last element in the arrayincreasingOrder - indicating the sort is in increasing order. Use true for increasing order, false for decreasing order.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||