|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nz.ac.waikato.jdsl.core.algo.sorts.HeapSort
public class HeapSort
Performs a heap-sort in O(n log n) time, provided only that the replaceElement(.) method of the Sequence works in O(1) time (and thus the style of implementation of the Sequence is not relevant). All of the Positions of the sequence are preserved, but their elements are moved around.
Constructor Summary | |
---|---|
HeapSort()
|
Method Summary | |
---|---|
void |
sort(Sequence s,
Comparator c)
Method that actually sorts the sequence, with the first element after the sort being the one that the comparator reported was smallest. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HeapSort()
Method Detail |
---|
public void sort(Sequence s, Comparator c)
SortObject
sort
in interface SortObject
s
- sequence to be sortedc
- comparator which defines in which order S is sorted
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |