When all elements are equal in height, the heap takes O (n) steps. Since when an element is added to the heap after O (1) comparison, we see that it is in the correct position.
Removing the root is also O (1), when we swap the tail and the root, the heap property is still satisfied.
O (n) O (n). , , heapsort O (n). , heapsorts O (n).
' Heapsorts O (n)' - - : n, k * n, . , , .