Class InPlaceStableQuicksort<T>

  • Type Parameters:
    T - the element type

    public class InPlaceStableQuicksort<T>
    extends java.lang.Object
    A stable quicksort implementation that uses O(log(n)) memory. It normally runs in O(n*log(n)*log(n)), but at most in O(n^2).
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> void sort​(T[] data, java.util.Comparator<T> comp)
      Sort an array using the given comparator.
      void sortArray​(T[] d, java.util.Comparator<T> c)
      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

      • InPlaceStableQuicksort

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