These implementations are for demonstration purposes. They are less efficient than the implementations in the Python standard library.
Heap sort works by visualizing the elements of the array as a special kind of complete binary tree called a heap. If the index of any element in the array is i, the element in the index 2i+1 will ...