Why is the optimal algorithm complexity of heap sorting O (nlgn) instead of O (n)?

imagine such a scenario. If all the elements in the heap are the same, then every time the heap is adjusted, there is no need to adjust the heap after the exchange of the top element and the tail element, and then the n elements will do so. Isn"t this sort time complexity O (n)

?
Mar.12,2021

https://en.wikipedia.org/wiki.

clipboard.png

is n, don't put too much faith in those online blog posts, in addition, different code may also lead to nlogn. Wikipedia, for example, also says nlogn (n, wrong).

https://zh.wikipedia.org/zh/%.

  

just saves the time of adjustment, and the number of comparisons between elements is still nlgn

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36adf-2b57e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36adf-2b57e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?