|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--arlut.csd.Util.QuickSort
QuickSort implementation for Object array. Uses the
Compare interface for item
comparisons.
Algorithm from
Based on code by Eric van Bezooijen (eric@logrus.berkeley.edu) and Roedy Green (roedy@bix.com).
| Field Summary | |
(package private) arlut.csd.Util.Compare |
comparator
|
(package private) java.lang.Object[] |
objects
|
| Constructor Summary | |
QuickSort(java.lang.Object[] objects,
arlut.csd.Util.Compare comparator)
|
|
| Method Summary | |
int |
compare(java.lang.Object a,
java.lang.Object b)
Default comparator, does a string comparison on the toString() output of the objects for ordering. |
private int |
partition(int first,
int last)
Partition by splitting this chunk to sort in two and get all big elements on one side of the pivot and all the small elements on the other. |
private void |
quick(int first,
int last)
|
void |
sort()
|
private void |
swap(int i,
int j)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
java.lang.Object[] objects
arlut.csd.Util.Compare comparator
| Constructor Detail |
public QuickSort(java.lang.Object[] objects,
arlut.csd.Util.Compare comparator)
| Method Detail |
private void quick(int first,
int last)
private int partition(int first,
int last)
Partition by splitting this chunk to sort in two and get all big elements on one side of the pivot and all the small elements on the other.
private void swap(int i,
int j)
public void sort()
public int compare(java.lang.Object a,
java.lang.Object b)
Default comparator, does a string comparison on the toString() output of the objects for ordering.
compare in interface Compare
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||