Skip to main content

HSortDem

HeapSort Demonstration

Sort a sequence by forming and successively reducing a heap

HeapSort

HeapSort first arranges the entries in a binary heap and then retires the largest entry one at a time.
  1. 1Demote entries until every superior majorizes its subordinates.
  2. 2Exchange the largest entry at the root with the last entry in the heap.
  3. 3Restore the heap property and repeat with the smaller heap.