[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sorting Algorythms



On Wednesday, December 19, 2012 12:51:09 PM UTC-8, Raymond Wiker wrote:
> gids.rs@sasktel.net writes:
> 
> 
> 
> > I am sure everyone has dabbled in and programmed a sorting algorythm at some time while playing on their Apple II computer.
> 
> >
> 
> > What I would like to know is there any programs out there other than the usual talked about ones or one they may have created themselves?
> 
> >
> 
> > Bubble sort, Bi-bubble sort, Shell Metzner sort, Quick Sort, Field Sort, Binary search sort, Heap sort, Interchange sort.
> 
> >
> 
> >
> 
> > And what is the fastest sort anyone has come across.  Is Quicksort the fastest?
> 
> > I re-engineered a sort that I came across, but I do not know the name of it, that is about 35% faster than the quicksort.  With the added advantage of leaving the original in tact as well as have multiple tag alongs and it sorts numbers properly where the number 2 is less than 10.  Most sorts will not sort numbers properly.
> 
> 
> 
> Hmmm... I was going to ignore this post, as discussions about sorting
> 
> algorithms in general is not what I read csa for, but...
> 
> 
> 
> ... "most sorts will not sort numbers properly"?
> 
> 
> 
> That's about the weirdest thing I've ever heard said about sorting
> 
> algorithms.
> 
> 
> 
> Anyway, it is well known that the performance of sorting algorithms
> 
> depends on a number of factors, including the number of items and
> 
> whether they are already in sequence (or mostly so). WikiPedia has a
> 
> good overview at http://en.wikipedia.org/wiki/Quicksort .

I, too, was planning on skipping this thread, yet...

What the OP probably meant (and assumed) with "most sorts will not sort numbers properly" was sorting strings that represent items that are not arranged in ordinal fashion.  Though commonly ignored in pure computer science, there are practical problems that need to accommodate these sorting scenarios.

Citing an example in Windows Explorer:  If you sort the entries in a directory by name, you would find that it returns "2ABC" before "12ABC" (but not so in a DOS Command Prompt). Even though we all know that straight string sorting should put "12ABC" ahead of "2ABC", the common end-user has this notion that numerical substrings should be sorted by numeric value.  It's not trivial.