All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jdsl.core.algo.sorts.ArrayMergeSort

java.lang.Object
   |
   +----jdsl.core.algo.sorts.ArrayMergeSort

public class ArrayMergeSort
extends Object
implements SortObject

Constructor Index

 o ArrayMergeSort()

Method Index

 o sort(Sequence, Comparator)
Performs a merge-sort, assuming the Sequence is vector-based.

Constructors

 o ArrayMergeSort
 public ArrayMergeSort()

Methods

 o sort
 public void sort(Sequence S,
                  Comparator c)
Performs a merge-sort, assuming the Sequence is vector-based.

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