List of utility methods to do Quick Sort
void | quickSort(T[] array, int[] index, int left, int right) quick Sort if (left < right) { int middle = partition(array, index, left, right); quickSort(array, index, left, middle); quickSort(array, index, middle + 1, right); |
void | quickSort1(double array[], int low, int n) Quicksort from RoseIndia. int lo = low; int hi = n; if (lo >= n) { return; double mid = array[(lo + hi) / 2]; while (lo < hi) { while (lo < hi && array[lo] < mid) { ... |
void | quickSort1(int target[], int fromIndex, int length, int[] coSort) This method is the same as #quickSort(int[],int,int,int[]) , but without range checking and toIndex -> length (see params). if (target == coSort) throw new IllegalArgumentException("Target reference == coSort reference."); quickSort2(target, fromIndex, length, coSort); |
void | quickSort2(int target[], int fromIndex, int length, int[] coSort) quick Sort if (length < 7) { for (int i = fromIndex; i < length + fromIndex; i++) for (int j = i; j > fromIndex && target[j - 1] > target[j]; j--) swap(target, j, j - 1, coSort); return; int m = fromIndex + (length >> 1); if (length > 7) { ... |
void | quickSortInt(int[] data, int[] dataIdx, int len) quick Sort Int int scanGt, scanLt, iterLen = len, k, l = 1; int[] stack = new int[65]; int stackIdx = 0; int dataElem, dataIdxElem, temp; int kDec, lDec = 0, iterLenDec = iterLen - 1; while (true) { if (iterLen - l < 7) { for (scanGt = l; scanGt < iterLen; scanGt++) { ... |
void | quickSortMaxToMin(int a[], int lo0, int hi0) This is a generic version of C.A.R Hoare's Quick Sort algorithm. int lo = lo0; int hi = hi0; int mid; if (hi0 > lo0) { mid = a[(int) Math.round((lo0 + hi0) / 2.0)]; while (lo <= hi) { while ((lo < hi0) && (a[lo] > mid)) ++lo; ... |
void | quickSortReverse(String[] sortedCollection, int left, int right) Sort the strings in the given collection in reverse alphabetical order. int original_left = left; int original_right = right; String mid = sortedCollection[(left + right) / 2]; do { while (sortedCollection[left].compareTo(mid) > 0) { left++; while (mid.compareTo(sortedCollection[right]) > 0) { ... |
double[] | quickSortReverso(double[] arr, int esquerda, int direita) quick Sort Reverso double[] vector = new double[arr.length]; if (arr == null || arr.length == 0) { return null; if (esquerda >= direita) { return null; double pivot = arr[esquerda + (direita - esquerda) / 2]; ... |
void | quickSortStringArray(String array[], int lo0, int hi0) Quick sort the given chunk of the array in place. int lo = lo0; int hi = hi0; String mid = null; if (hi0 > lo0) { mid = array[(lo0 + hi0) / 2]; while (lo <= hi) { while ((lo < hi0) && (array[lo].compareTo(mid) < 0)) ++lo; ... |