This topic is now archived and is closed to further replies.

The heap sort

This topic is 5706 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

A very slight difference. If you implement it so that you don''t have to swap at every level (just keep the value you bubble up or down to the side), you''ll have to make about log(n) copies (base 2, of course) in the worst case. I''m no expert on algorithm analysis, but at a guess, this would happen fairly often, in about 50% of the cases with a full leaf level. Still, no matter what, Heap Sort is O(log(n)), which is pretty good.

Share this post

Link to post
Share on other sites