View Single Post
  #14  
Old 11-19-2007, 11:02 AM
jukofyork jukofyork is offline
Senior Member
 
Join Date: Sep 2004
Location: Leeds, UK.
Posts: 2,551
Default Re: Best Sorting Algorithm For Large Numbers

[ QUOTE ]
Aside: If you don't have an upper bound on the size of your numbers, the (provably) fastest sorting algorithms are O(n log n). For the reasons above, most sorting algorithms that are built into software use quicksort (O(n log n)) when n > 7, and something like bubble sort or insertion sort (O(n^2)) when n <= 7. Even though the latter algorithms are slower asymptotically, for small enough instances, they are pretty fast.

[/ QUOTE ]
For very small values of n, then the best choice is usually to use a Sorting Network with hard-coded compare and swap operations to reduce overhead to a minimum.

Juk [img]/images/graemlins/smile.gif[/img]
Reply With Quote