PDA

Click to See Complete Forum and Search --> : Fast Sort


Jan 27th, 2000, 06:37 PM
Hi,

Does anybody know of a routine to sort a string array VERY fast? I have been using a BubbleSort routine I wrote, but it's pretty slow. I have tried some other sort routines, but they also are slow.

Thanks

------------------
Richard Moss

ariad@globalnet.co.uk
http://www.users.globalnet.co.uk/~ariad/

Buzby
Jan 27th, 2000, 07:23 PM
It could be classed as cheating but I would create a listbox on the form, make it invisible, set it's Sorted property to TRUE and do this;

Listbox1.clear
For i=0 to 100
listbox1.additem myarray(i)
next
for i=0 to listbox1.listcount-1
myarray(i)=listbox.list(i)
next

I haven't tested this but it should be ok - you're just writing stuff into a listbox, and then reading it out - providing the array isn't that massive it should be quite quick.




------------------
Mark "Buzby" Beeton
VB Developer
BuzbyB@HotMail.Com

Jan 27th, 2000, 08:01 PM
Mark,

Thanks for the reply.

Unfortuantly, in this case this is not an option, as the sort is required in a class module and everything must be pure self contained code.

Thanks anyway!

------------------
Richard Moss

ariad@globalnet.co.uk
http://www.users.globalnet.co.uk/~ariad/

Jan 27th, 2000, 10:41 PM
Check out htis site:
http://www.cs.ubc.ca/spider/harrison/Java/sorting-demo.html

It has demos and code for all kinds of sorts.

------------------
Boothman
There is a war out there and it is about who controls the information, it's all about the information.