+ 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

6th Oct 2020, 5:46 PM
Abhay
Abhay - avatar
4 Answers
+ 2
but they were really helpful to me , just because someone didn't really leave a like or so , doesn't mean anything ,I would have really loved if you stayed on this platform helping people like me since most are beginners here ,tho good luck to you as well!
10th Oct 2020, 6:56 AM
Abhay
Abhay - avatar
+ 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 !!
6th Oct 2020, 9:19 PM
Abhay
Abhay - avatar
0
did something happened ? Just eager to know as you removed all the answers or they got deleted somehow!! You had a good explanation and I was just going through it and using some other references as well to understand how things work
7th Oct 2020, 6:27 PM
Abhay
Abhay - avatar