nz.ac.waikato.jdsl.core.algo.sorts
Class ArrayMergeSort

java.lang.Object
  extended by nz.ac.waikato.jdsl.core.algo.sorts.ArrayMergeSort
All Implemented Interfaces:
SortObject

public class ArrayMergeSort
extends java.lang.Object
implements SortObject

Performs a merge-sort in O(n log n) time, provided that the atRank(int) method of the Sequence works in O(1) time.

Version:
JDSL 2.1.1
Author:
Benoit Hudson, Keith Schmidt

Constructor Summary
ArrayMergeSort()
           
 
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

ArrayMergeSort

public ArrayMergeSort()
Method Detail

sort

public void sort(Sequence S,
                 Comparator c)
Description copied from interface: SortObject
Method that actually sorts the sequence, with the first element after the sort being the one that the comparator reported was smallest.

Specified by:
sort in interface SortObject
Parameters:
S - sequence to be sorted
c - comparator which defines in which order S is sorted


Copyright © 2009 ModelJUnit Project. All Rights Reserved.