本文整理了Java中weka.core.Utils.quickSort()
方法的一些代码示例,展示了Utils.quickSort()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.quickSort()
方法的具体详情如下:
包路径:weka.core.Utils
类名称:Utils
方法名:quickSort
[英]Implements quicksort with median-of-three method and explicit sort for problems of size three or less.
[中]
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Implements quicksort according to Manber's "Introduction to Algorithms".
*
* @param array the array of integers to be sorted
* @param index the index into the array of integers
* @param left the first index of the subset to be sorted
* @param right the last index of the subset to be sorted
*/
// @ requires 0 <= first && first <= right && right < array.length;
// @ requires (\forall int i; 0 <= i && i < index.length; 0 <= index[i] &&
// index[i] < array.length);
// @ requires array != index;
// assignable index;
private static void quickSort(/* @non_null@ */int[] array, /* @non_null@ */
int[] index, int left, int right) {
if (left < right) {
int middle = partition(array, index, left, right);
quickSort(array, index, left, middle);
quickSort(array, index, middle + 1, right);
}
}
代码示例来源:origin: Waikato/weka-trunk
/**
* Implements quicksort according to Manber's "Introduction to Algorithms".
*
* @param array the array of integers to be sorted
* @param index the index into the array of integers
* @param left the first index of the subset to be sorted
* @param right the last index of the subset to be sorted
*/
// @ requires 0 <= first && first <= right && right < array.length;
// @ requires (\forall int i; 0 <= i && i < index.length; 0 <= index[i] &&
// index[i] < array.length);
// @ requires array != index;
// assignable index;
private static void quickSort(/* @non_null@ */int[] array, /* @non_null@ */
int[] index, int left, int right) {
if (left < right) {
int middle = partition(array, index, left, right);
quickSort(array, index, left, middle);
quickSort(array, index, middle + 1, right);
}
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
int numEqual;
quickSort(array, index, 0, array.length - 1);
helpIndex[j] = i + j;
quickSort(index, helpIndex, 0, numEqual - 1);
for (int j = 0; j < numEqual; j++) {
newIndex[i + j] = index[helpIndex[j]];
代码示例来源:origin: Waikato/weka-trunk
int numEqual;
quickSort(array, index, 0, array.length - 1);
helpIndex[j] = i + j;
quickSort(index, helpIndex, 0, numEqual - 1);
for (int j = 0; j < numEqual; j++) {
newIndex[i + j] = index[helpIndex[j]];
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Sorts a given array of doubles in ascending order and returns an array of
* integers with the positions of the elements of the original array in the
* sorted array. Missing values in the given array are replaced by
* Double.MAX_VALUE, so the array is modified in that case!
*
* @param array the array to be sorted, which is modified if it has missing
* values
* @return an array of integers with the positions in the sorted array.
*/
public static/* @pure@ */int[] sortWithNoMissingValues(
/* @non_null@ */double[] array) {
int[] index = initialIndex(array.length);
if (array.length > 1) {
quickSort(array, index, 0, array.length - 1);
}
return index;
}
代码示例来源:origin: Waikato/weka-trunk
/**
* Sorts a given array of doubles in ascending order and returns an array of
* integers with the positions of the elements of the original array in the
* sorted array. Missing values in the given array are replaced by
* Double.MAX_VALUE, so the array is modified in that case!
*
* @param array the array to be sorted, which is modified if it has missing
* values
* @return an array of integers with the positions in the sorted array.
*/
public static/* @pure@ */int[] sortWithNoMissingValues(
/* @non_null@ */double[] array) {
int[] index = initialIndex(array.length);
if (array.length > 1) {
quickSort(array, index, 0, array.length - 1);
}
return index;
}
代码示例来源:origin: Waikato/weka-trunk
quickSort(array, index, 0, array.length - 1);
helpIndex[j] = i + j;
quickSort(index, helpIndex, 0, numEqual - 1);
for (int j = 0; j < numEqual; j++) {
newIndex[i + j] = index[helpIndex[j]];
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
quickSort(array, index, 0, array.length - 1);
helpIndex[j] = i + j;
quickSort(index, helpIndex, 0, numEqual - 1);
for (int j = 0; j < numEqual; j++) {
newIndex[i + j] = index[helpIndex[j]];
代码示例来源:origin: Waikato/weka-trunk
/**
* Sorts a given array of doubles in ascending order and returns an array of
* integers with the positions of the elements of the original array in the
* sorted array. NOTE THESE CHANGES: the sort is no longer stable and it
* doesn't use safe floating-point comparisons anymore. Occurrences of
* Double.NaN are treated as Double.MAX_VALUE.
*
* @param array this array is not changed by the method!
* @return an array of integers with the positions in the sorted array.
*/
public static/* @pure@ */int[] sort(/* @non_null@ */double[] array) {
int[] index = initialIndex(array.length);
if (array.length > 1) {
array = array.clone();
replaceMissingWithMAX_VALUE(array);
quickSort(array, index, 0, array.length - 1);
}
return index;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Sorts a given array of doubles in ascending order and returns an array of
* integers with the positions of the elements of the original array in the
* sorted array. NOTE THESE CHANGES: the sort is no longer stable and it
* doesn't use safe floating-point comparisons anymore. Occurrences of
* Double.NaN are treated as Double.MAX_VALUE.
*
* @param array this array is not changed by the method!
* @return an array of integers with the positions in the sorted array.
*/
public static/* @pure@ */int[] sort(/* @non_null@ */double[] array) {
int[] index = initialIndex(array.length);
if (array.length > 1) {
array = array.clone();
replaceMissingWithMAX_VALUE(array);
quickSort(array, index, 0, array.length - 1);
}
return index;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
quickSort(array, index, left, center - 1);
quickSort(array, index, center + 1, right);
代码示例来源:origin: Waikato/weka-trunk
quickSort(array, index, left, center - 1);
quickSort(array, index, center + 1, right);
内容来源于网络,如有侵权,请联系作者删除!