Insertion sort is worstcase O(N^2), not always O(N^2).

Shellsort gives more or less respectable performance
for most anything you could do except with extremely
large data sets (Think 10's of thousands).

I will agree we have a few situations at my work
as well where it is more db call's or more work
where as having  a CF method to sort would be the
best :)

Hmmn.. Maybe its time to publish my first few CFX's..

I notice Rick, who lingers about this list wrote
CFX_QuerySort, which implements quicksort :)

Quicksort as its name implies is pretty much the
fastest general sorting algorithm and it is *fast* :)

However it only sorts queries fields which you could
not normally sort on..

So.. I suppose ill ask the list what would be most useful
for this sort of sorting routine as inputs?

I cant really see many cases where you should be using
3D arrays except in CF.



INPUT:
        array:Array to be sorted
        "column:"column to be sorted on?
        (index [x][2]) where position [x][2]
        might contain the 'name' field that you
        were wanting to sort the array on?

OUTPUT:
        sorted array


Hmmn.. That is it in a nutshell..

Anyone else have any feedback speak now or
I wont do it :)


(I got so itchy to code the CFX after everyone
talked about it so much)

Jeremy Allen
[EMAIL PROTECTED]
[Insert Quarter]



-----Original Message-----
From: Dana Larose [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 25, 2000 2:03 PM
To: [EMAIL PROTECTED]
Subject: RE: arraysort


> There are some routines that you could implement
> in ColdFusion that would perform better than
> Bubblesort (InsertionSort, Shellsort).

>From what I can tell in the app I wrote the bubble sort for (it was the only
sort whose algorithm I could remember of the top of my head), sorting even a
couple hundred records was taking 200-300 milliseconds.

IIRC, InsertionSort still gives you O(n^2).  I've been planning to write a
qsort or shellsort and try them out when I have a bit of time.

SQL is better, sure , but I've run into a couple of instances where I have
to sort 2d arrays in CF.

Dana Larose
ColdFusion Monkey
Canadian Web Design & Consulting Inc.

A: 701-281 McDermot Avenue (McDermot & King)
P: 204.946.5155
C: 204.228.0477
F: 204.946.5156
E: [EMAIL PROTECTED]
W: http://www.cdnwebdesign.com

The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorized.  If you are not the intended recipient, any disclosure,
copying, distribution or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful. When addressed to our clients any
opinions or advice contained in this email are subject to the terms and
conditions expressed in the applicable Canadian Web Design & Consulting Inc.
client engagement contract.


----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to