C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 06-25-2008, 12:44 PM   #1
Registered User
 
Join Date: Apr 2007
Location: Greece
Posts: 52
Heapsort

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.
myle is offline   Reply With Quote
Old 06-25-2008, 12:57 PM   #2
and the Hat of Guessing
 
tabstop's Avatar
 
Join Date: Nov 2007
Posts: 8,862
I typed "C++ heapsort" into google, and most of the results on the first two pages had implementations.
tabstop is offline   Reply With Quote
Old 06-25-2008, 01:14 PM   #3
MENTAL DETECTOR
 
whiteflags's Avatar
 
Join Date: Apr 2006
Location: United States
Posts: 3,295
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.
whiteflags is offline   Reply With Quote
Old 06-25-2008, 01:45 PM   #4
Registered User
 
Join Date: Apr 2007
Location: Greece
Posts: 52
The best result till now is this:
http://en.wikibooks.org/wiki/Algorit...rting/Heapsort

Thanks for your replies though.
myle is offline   Reply With Quote
Old 06-26-2008, 01:16 AM   #5
Algorithm Dissector
 
iMalc's Avatar
 
Join Date: Dec 2005
Location: New Zealand
Posts: 2,746
Quote:
Originally Posted by myle View Post
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.
__________________
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
iMalc is offline   Reply With Quote
Old 06-26-2008, 01:44 AM   #6
dra
Weak.
 
dra's Avatar
 
Join Date: Apr 2005
Posts: 166
Here's an awesome article about various sorting algorithms including Heapsort

http://www.eternallyconfuzzled.com/t...t_sorting.aspx
dra is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Heapsort xENGINEERx C Programming 2 03-30-2008 07:17 PM
heapsort help please! MAC77 C++ Programming 2 12-14-2005 12:28 PM
Heapsort abalfazl C Programming 2 08-06-2005 06:11 PM
heapsort problem... talz13 C++ Programming 9 09-23-2003 04:06 PM
heapsort help plz nsssn73 C# Programming 0 06-02-2002 06:54 AM


All times are GMT -6. The time now is 02:29 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22