Class InPlaceStableMergeSort<T>

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

public class InPlaceStableMergeSort<T> extends Object
A stable merge sort implementation that uses at most O(log(n)) memory and O(n*log(n)*log(n)) time.
  • Constructor Details

    • InPlaceStableMergeSort

      public InPlaceStableMergeSort()
  • Method Details

    • sort

      public static <T> void sort(T[] data, 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[] d, Comparator<T> c)
      Sort an array using the given comparator.
      Parameters:
      d - the data array to sort
      c - the comparator