Heap sort is a sorting algorithm that takes the input data and sorts it in ascending or descending order. A Heap is a tree-like structure which is built using the input data.
The algorithm requires 3 steps to complete the sorting procedure:
Create a heap with the input data.
Sort the elements of the heap are sorted in ascending order.
Swap the root node with the last node and delete the last node from the heap.
Following slides will assist you in understanding this concept better:
The following codes implement the heap sort algorithm in C++ and Python.