View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Myrna Larson Myrna Larson is offline
external usenet poster
 
Posts: 863
Default Sorting Algorithm required!

Go to the Google newsgroups search, and search the microsoft.public.excel.*
groups for quicksort. Several QS procedures have been posted. But, AIR, they
would have to be modified to sort with two keys. (You can't run QS once on the
less significant key, then a 2nd time on the more significant key, because QS
isn't 'stable'.)


On Mon, 25 Oct 2004 20:29:32 -0500, agarwaldvk
wrote:


Hi All


Whilst Excel sorting is extremely quick, I sometimes have a need to
sort arrays (and reasonably large ones at that say of the order of
30000 Excel rows and 10 Excel columns sorted by 1 or 2 columns). I
tried to do that in VBA Excel for an array of 5500 rows and 10 columns
and it took around 5 minutes but Excel sorted the same data in less
than a minute. So in this instance, I did take that option but this may
not be always possible or feasible!

I am advised that quicksort is pretty efficient for unsorted data
(whilst performing poorly for nearly sorted dataset - which more than
likely would never be the case for my dataset) and counting sort is
lighting fast, can anyone help me write (relatively easily) a VBA code
for either of these sort procedures or gulde me to a website where some
assitance can be available?

For the reason stated above, I would additionally like to be able to
sort arrays using one of the 2 alternatives, if possible!

Any assistance or help shall be highly valued.


Best regards


Deepak Agarwal