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

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

public class ListMergeSort
extends java.lang.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

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

Constructor Detail

ListMergeSort

public ListMergeSort()
Method Detail

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 sort
c - the comparator to use in the sort


Copyright © 2009 ModelJUnit Project. All Rights Reserved.