+ 5
How do you calculate time complexity of heap sort?
The way I have implemented is typically the same I have seen while going through tutorials but it results in time complexity of close to O (n*n) instead of O(n log n ),so is my way of calculating it wrong which results in more iterations? Any help is much appreciated . https://code.sololearn.com/csja3X5EFZYH/?ref=app
4 ответов
+ 1
ty for your response ,I am not sure how all those doubling ratio and end result is calculated for n number of elements but you are right with them somehow
Also your previous answer helped me a lot and I was actually comparing this time based on iterations ,for 5 I got 12 and for 10 45 and for 14 ,84 ,these are somehow close to the ones that selection sort was giving so really don't understand yet what is going on ,for 20 it should make 84 iterations if we go with n log(n) but 161 is a lot , what's more suprising to me is when I sorted array for 3000 numbers ,total iterations made were 2283213 !!



