Where can I found a good implementation of heapsort? (I don't care if it's C++ or C)

Google didn't help me a lot. It would be ideal to find the implementation that is used by some efficient library, or just a (proven?) efficient implementation.

Printable View

- 06-25-2008myleHeapsort
Where can I found a good implementation of heapsort? (I don't care if it's C++ or C)

Google didn't help me a lot. It would be ideal to find the implementation that is used by some efficient library, or just a (proven?) efficient implementation. - 06-25-2008tabstop
I typed "C++ heapsort" into google, and most of the results on the first two pages had implementations.

- 06-25-2008whiteflags
Library implementations are usually very general and you wouldn't necessarily learn how heap sort works any better than if you wrote a routine to sort a datatype you know, such as int. Keep the implementations you learn from specific until you know the algorithm.

- 06-25-2008myle
The best result till now is this:

http://en.wikibooks.org/wiki/Algorit...rting/Heapsort

Thanks for your replies though. - 06-26-2008iMalc
What's wrong with that page? (apart from the horrible syntax hilighting colors)

If you want a proven efficient implementation you could read the implementations of make_heap and sort_heap from your favourite C++ compiler. But I think you'll find the ones you linked to a bit more readable. - 06-26-2008dra
Here's an awesome article about various sorting algorithms including Heapsort

http://www.eternallyconfuzzled.com/t...t_sorting.aspx