Jump to content
  • Advertisement

Archived

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

Mulligan

The heap sort

This topic is 5894 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

The sort efficiency for a heap sort is always the same. Does that mean that there are no best/worst case lists for a heap sort to sort?

Share this post


Link to post
Share on other sites
Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!