|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--Opus5.AbstractSorter
|
+--Opus5.HeapSorter
Sorter for sorting an array of Comparable objects.
Implements heapsort.
Comparable| Field Summary | |
protected static int |
base
The first element of a heap has the number 1 (not zero). |
| Fields inherited from class Opus5.AbstractSorter |
array, n |
| Fields inherited from interface Opus5.Sorter |
copyright |
| Constructor Summary | |
HeapSorter()
|
|
| Method Summary | |
protected void |
buildHeap()
Builds a heap from the unsorted array. |
protected void |
percolateDown(int i,
int length)
Percolates the object at position |
protected void |
sort()
Sorts the array of comparable objects. |
| Methods inherited from class Opus5.AbstractSorter |
sort, swap |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static final int base
| Constructor Detail |
public HeapSorter()
| Method Detail |
protected void percolateDown(int i,
int length)
i - The position of the object to be percolated down.length - The length of the heap.protected void buildHeap()
protected void sort()
sort in class AbstractSorter
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||