Package smile.sort

Interface HeapSort


public interface HeapSort
Heapsort is a comparison-based sorting algorithm, and is part of the selection sort family. Although somewhat slower in practice on most machines than a good implementation of quicksort, it has the advantage of a worst-case O(n log n) runtime. In fact, its worst case is only 20% or so worse than its average running time. Heapsort is an in-place algorithm, but is not a stable sort.
  • Method Summary

    Static Methods
    Modifier and Type
    Method
    Description
    static void
    sort(double[] x)
    Sorts the specified array into ascending numerical order.
    static void
    sort(float[] x)
    Sorts the specified array into ascending numerical order.
    static void
    sort(int[] x)
    Sorts the specified array into ascending numerical order.
    static <T extends Comparable<? super T>>
    void
    sort(T[] x)
    Sorts the specified array into ascending order.
  • Method Details

    • sort

      static void sort(int[] x)
      Sorts the specified array into ascending numerical order.
      Parameters:
      x - the array.
    • sort

      static void sort(float[] x)
      Sorts the specified array into ascending numerical order.
      Parameters:
      x - the array.
    • sort

      static void sort(double[] x)
      Sorts the specified array into ascending numerical order.
      Parameters:
      x - the array.
    • sort

      static <T extends Comparable<? super T>> void sort(T[] x)
      Sorts the specified array into ascending order.
      Type Parameters:
      T - the data type of array elements.
      Parameters:
      x - the array.