Sort algorithm

Xinok xnknet at gmail.com
Wed Jan 24 11:52:39 PST 2007


Andrei Alexandrescu (See Website For Email) Wrote:

> Alain wrote:
> > Hi,
> > 
> > I have a question related to the sort function.
> > Does anyone know which algorithm is used in the built-in array sort function.
> > I needed to sort 256 integers. By using a radix sort, i got 30 usec on my laptop. But using the built-in sort, i get 20 usec.
> > I thought the radix sort was pretty efficient.
> > Any idea?
> 
> Radix sort's running time has a larger multiplier than qsort. Try 
> sorting more numbers and beyond a side radix sort may win.
> 
> Andrei

You may also want to try shell sort, it's very efficient and easy to implement. Radix Sort takes a very large block of data to be the fastest algorithm. I compared it against shell sort before, it took a few million elements for radix sort to be quicker.



More information about the Digitalmars-d mailing list