Message-Id: <2.2.32.19970312203832.00687230@mailhost> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Wed, 12 Mar 1997 18:38:32 -0200 To: djgpp AT delorie DOT com From: Eyal Ben-David Subject: Re: Sorting? >> Is there an algorithm available for a very fast sort? >Look at the sources for the 'qsort()' function, which is >part of djlsr201.zip which implements the Quick Sort >algorithm. > As an alternative if you use C++ and you know about templates, look at the header file /lang/cxx/algo.h This file is the STL implementation of many algorithms (including sort) "... Importantly the resulting generic algorithms are efficient even compared to hand crafted assembly code. For example the C++ standard library algorithm 'sort()' is for many simple and realistic examples several times faster than the C standard library 'qsort()' ..." [Stroustrup] The STL function 'sort()' is faster since you can inline the comparison function whereas in C 'qsort()' you must give the address of a real function. Eyal.