Crossfire JXClient, Trunk
|
Public Member Functions | |
void | sort (int a[]) throws Exception |
Public Member Functions inherited from SortAlgorithm | |
void | init () |
void | setParent (SortItem p) |
void | stop () |
Package Functions | |
void | QuickSort (int a[], int lo0, int hi0) throws Exception |
Private Member Functions | |
boolean | pauseTrue (int lo, int hi) throws Exception |
void | swap (int a[], int i, int j) |
Additional Inherited Members | |
Protected Member Functions inherited from SortAlgorithm | |
void | pause () throws Exception |
void | pause (int H1) throws Exception |
void | pause (int H1, int H2) throws Exception |
Protected Attributes inherited from SortAlgorithm | |
boolean | stopRequested = false |
A quick sort demonstration algorithm SortAlgorithm.java
Definition at line 49 of file QSortAlgorithm.java.
|
private |
A version of pause() that makes it easier to ensure that we pause exactly the right number of times.
Definition at line 55 of file QSortAlgorithm.java.
Referenced by QuickSort().
|
package |
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 |
Definition at line 74 of file QSortAlgorithm.java.
References a, pauseTrue(), and swap().
Referenced by sort().
void QSortAlgorithm.sort | ( | int | a[] | ) | throws Exception |
This method will be called to sort an array of integers.
Reimplemented from SortAlgorithm.
Definition at line 136 of file QSortAlgorithm.java.
References a, and QuickSort().
|
private |
Definition at line 127 of file QSortAlgorithm.java.
References a.
Referenced by QuickSort().