jdsl.core.algo.sorts
Class ListMergeSort

java.lang.Object
  |
  +--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:
$Id: ListMergeSort.java,v 1.4 2000/01/12 03:21:22 mdh Exp $
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