All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----jdsl.core.algo.sorts.ArrayMergeSort
public ArrayMergeSort()
public void sort(Sequence S, Comparator c)
The design of mergesort is somewhat more complex than that of the
other sorts: first, there's the main function,
mergeSort(.)
; this is a convenience function that just
calls mergeSortHelper(.)
with default parameters (a
common tactic in recursive algorithms).
mergeSortHelper(.)
recursively calls itself twice,
sorting the first and second halves of the sequence. The two
sub-arrays are then merged, yielding a sorted sequence.
All Packages Class Hierarchy This Package Previous Next Index