Sorting algorithms/Heapsort: Difference between revisions

Content added Content deleted
m (added Category:Sorting)
m (added whitespace.)
Line 12: Line 12:
We repeatedly "remove" the maximal element from the heap, thus building the sorted list from back to front.
We repeatedly "remove" the maximal element from the heap, thus building the sorted list from back to front.


Heapsort requires random access, so can only be used on an array-like data structure.
A heap sort requires random access, so can only be used on an array-like data structure.


Pseudocode:
Pseudocode: