jdsl.core.algo.sorts
Class ListMergeSort
java.lang.Object
jdsl.core.algo.sorts.ListMergeSort
- All Implemented Interfaces:
- SortObject
- public class ListMergeSort
- extends Object
- implements SortObject
Performs a merge-sort in O(n log n) time, provided that isEmpty(),
first(), insertLast(), and removeFirst() all operate in O(1) time.
- Version:
- JDSL 2.1.1
- Author:
- Benoit Hudson, Roberto Tamassia, Luca Vismara, Keith Schmidt
Method Summary |
void |
sort(Sequence S,
Comparator c)
Recursively divides a Sequence into (roughly) equal subsequences
and merges them back together once sorted. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ListMergeSort
public ListMergeSort()
sort
public void sort(Sequence S,
Comparator c)
- Recursively divides a Sequence into (roughly) equal subsequences
and merges them back together once sorted.
- Specified by:
sort
in interface SortObject
- Parameters:
S
- the sequence to sortc
- the comparator to use in the sort