jdsl.core.algo.sorts
Interface SortObject
- All Known Implementing Classes:
- ArrayQuickSort, ListMergeSort, ArrayMergeSort, HeapSort
- public interface SortObject
Algorithm interface for sorting a sequence according to a given
comparator of elements. All sorting algorithms are expected to
modify the Sequence passed in as a parameter (no new Sequence is
returned). No guarantee is made that the Position-element binding
is preserved, or even that positions and their decorations are preserved.
If the comparator encounters an element which it is unable to compare, a
ClassCastException will be thrown, as is documented in the
EqualityComparator and Comparator interfaces in jdsl.core.api.
Running times (time complexities) given for individual algorithms
depend on the assumption that the comparator can compare two
elements in constant time.
- Version:
- JDSL 2.0.6
- Author:
- Benoit Hudson, Keith Schmidt
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. |
sort
public 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.
- Parameters:
s
- sequence to be sortedc
- comparator which defines in which order S is sorted