Java Utililty Methods Quick Sort

List of utility methods to do Quick Sort

Description

The list of methods to do Quick Sort are organized into topic(s).

Method

voidquickSort(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);
voidquickSort1(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) {
...
voidquickSort1(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);
voidquickSort2(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) {
...
voidquickSortInt(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++) {
...
voidquickSortMaxToMin(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;
...
voidquickSortReverse(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];
...
voidquickSortStringArray(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;
...