Class qsort


public class qsort
extends java.lang.Object

This class supports the Quicksort algorithm. This is a slightly modified version of the Qsort class written by James Gosling at Sun Microsystems (see below).

Constructor Summary
Method Summary
(package private) static void QuickSort(double[] a, int lo0, int hi0)
          This is a generic version of C.A.R Hoare's Quick Sort algorithm.
static void sort(double[] a)
private static void swap(double[] a, int i, int j)
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait

Constructor Detail


public qsort()
Method Detail


static void QuickSort(double[] a,
                      int lo0,
                      int hi0)
This is a generic version of C.A.R Hoare's Quick Sort algorithm. This will handle arrays that are already sorted, and arrays with duplicate keys.
If you think of a one dimensional array as going from the lowest index on the left to the highest index on the right then the parameters to this function are lowest index or left and highest index or right. The first time you call this function it will be with the parameters 0, a.length - 1.
a - an integer array
lo0 - left boundary of array partition
hi0 - right boundary of array partition


private static void swap(double[] a,
                         int i,
                         int j)


public static void sort(double[] a)