Class Heapsort

java.lang.Object
algorithmcomparison.Heapsort

public class Heapsort extends Object
Heapsort
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    heapify(int[] arr, int n, int i)
    Builds a heap from array
    static int[]
    sort(int[] data)
    Sorts the data with heap sort

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Heapsort

      public Heapsort()
  • Method Details

    • sort

      public static int[] sort(int[] data)
      Sorts the data with heap sort
      Parameters:
      data - The unsorted data
      Returns:
      arr
    • heapify

      public static void heapify(int[] arr, int n, int i)
      Builds a heap from array