Java Quick Sort quicksort(double lista1[], int lista2[], int izq, int der)

Here you can find the source of quicksort(double lista1[], int lista2[], int izq, int der)

Description

quicksort

License

Open Source License

Declaration

public static void quicksort(double lista1[], int lista2[], int izq, int der) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static void quicksort(double lista1[], int lista2[], int izq, int der) {
        int i = izq;
        int j = der;
        double pivote = lista1[(i + j) / 2];
        do {//  www.  j a v  a 2  s.c  om
            while (lista1[i] < pivote) {
                i++;
            }
            while (lista1[j] > pivote) {
                j--;
            }
            if (i <= j) {
                double aux = lista1[i];
                int aux2 = lista2[i];
                lista1[i] = lista1[j];
                lista1[j] = aux;
                lista2[i] = lista2[j];
                lista2[j] = aux2;
                i++;
                j--;
            }
        } while (i <= j);
        if (izq < j) {
            quicksort(lista1, lista2, izq, j);
        }
        if (i < der) {
            quicksort(lista1, lista2, i, der);
        }
    }
}

Related

  1. quickSort( double[] array, int[] index, int left, int right)
  2. quickSort( double[] array, int[] index, int left, int right)
  3. quickSort( float[] array, int[] index, int left, int right)
  4. quicksort(Comparable[] a)
  5. quickSort(double[] array, int low, int high)
  6. quickSort(double[] array, int[] idx, int from, int to)
  7. quicksort(double[] main, int[] index)
  8. quicksort(final double[] array, final int[] index)