|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sort.qsort
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 qsort()
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 qsort
public qsort()
Method Detail QuickSort
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.
- Parameters:
a
- an integer arraylo0
- left boundary of array partitionhi0
- right boundary of array partition
swap
private static void swap(double[] a, int i, int j)
sort
public static void sort(double[] a)
Overview Package Class Tree Deprecated Index Help PREV CLASS NEXT CLASS FRAMES NO FRAMES SUMMARY: INNER | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD