org.h2.dev.sort
Class InPlaceStableMergeSort<T>

java.lang.Object
  extended by org.h2.dev.sort.InPlaceStableMergeSort<T>
Type Parameters:
T - the element type

public class InPlaceStableMergeSort<T>
extends java.lang.Object

A stable merge sort implementation that uses at most O(log(n)) memory and O(n*log(n)*log(n)) time.


Constructor Summary
InPlaceStableMergeSort()
           
 
Method Summary
static
<T> void
sort(T[] data, java.util.Comparator<T> comp)
          Sort an array using the given comparator.
 void sortArray(T[] data, java.util.Comparator<T> comp)
          Sort an array using the given comparator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InPlaceStableMergeSort

public InPlaceStableMergeSort()
Method Detail

sort

public static <T> void sort(T[] data,
                            java.util.Comparator<T> comp)
Sort an array using the given comparator.

Parameters:
data - the data array to sort
comp - the comparator

sortArray

public void sortArray(T[] data,
                      java.util.Comparator<T> comp)
Sort an array using the given comparator.

Parameters:
data - the data array to sort
comp - the comparator