|
Algorithm Development Kit 1.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectalgs.model.array.QuickSort
public class QuickSort
Provide class to experiment with 'selectPivotIndex' and different minimum size problems for which InsertionSort is used instead.
Constructor Summary | |
---|---|
QuickSort(java.lang.Comparable[] ar)
|
Method Summary | |
---|---|
int |
partition(int left,
int right,
int pivotIndex)
In linear time, group an array into two parts, those less than a certain value (left), and those greater than or equal to a certain value (right). |
void |
qsort(int left,
int right)
Sort using quicksort method. |
void |
setMinimumSize(int ms)
Set the minimum problem size at and below which InsertionSort is used. |
void |
setPivotMethod(IPivotIndex ipi)
Determine the method used to select a pivot index. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public QuickSort(java.lang.Comparable[] ar)
Method Detail |
---|
public void setMinimumSize(int ms)
public void setPivotMethod(IPivotIndex ipi)
public int partition(int left, int right, int pivotIndex)
left
- lower bound index positionright
- upper bound index positionpivotIndex
- index around which the partition is being made.
public void qsort(int left, int right)
If subarrays to be sorted are smaller in size than 'minSize' then
use Insertion Sort as coded in insertion(int, int)
.
left
- The left-bounds within which to sort (0 <= left < ar.length)right
- The right-bounds within which to sort (0 <= right < ar.length)
|
Algorithm Development Kit 1.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |