BB> It makes no difference to the main point. Sorting is a matter of
BB>algorithms, and algorithms can be converted to any half way decent
programmi
Sorting is more than just algorithms. Knuth's O() notation can be of
interest, but the assumptions behind it (ie: that all operations take
the same length of time and that the cost of those operations themselves
don't change when the size of the data or data set changes, and that
random accesses can be done with zero delay) are flawed. Even Knuth
admits in places that the Big Oh notation is only theoretical and
doesn't exactly match the real world, but that when discussing and
comparing algorithms, you have to use _some_ measurement. (And I
certainly agree that for theoretical discussions, such as a ref book,
the Big Oh notation is certainly better than timing a run of a
particular implementation on a particular machine with a particular
compiler with a particular set of data.)
Also, the 'O' can hide other differences. A poorly implemented
algorithm with good growth might be slower than a superbly implemented
one with slightly worse growth.
Back in my 8 bit days, I ran into a situtation where a bubble sort was
faster than quick-sort. I was writing one of the many chess / checkers
programs I've done over the years, and I was needing to sort the moves I
had just generated. (On average, around 35 6 byte structures.) After
profiling it, I discovered a lot of time was being spent in the sorting,
and not having any source for any other sort handy, I actually tried my
own little bubble sort and it was consistantly _faster_ than quick-sort
was. Admittedly, it wasn't typical, but it did go against all
theoretical expectations, and it did happen in a real situation (ie: it
wasn't contrived for example purposes.)
Theoretical results (ie: Big Oh) are certainly something you should
consider before you implement it, (and in most real situations, I'll
certainly reach for a sort other than something like a bubble sort!!)
but it's not the last word. There are many real world conditions that
can influence things. There are even many situations where it doesn't
matter what sort algorithm you use because you spend so little time
sorting that it just doesn't matter. (ie: if you are only sorting once,
and you only have 100 (for example) items, it doesn't matter whether you
use a bubble sort or a quick sort or anything else.)
BB>language, so there is no intrinsic connection between C and the current
rage
Programming algorithms are on topic in _every_ programming echo. To
take the algorithm off that page, you have to implement it in some
language, and you have to make decisions as to how you chose to do it
(which effects its efficiency and the 'O' in the O() notation.)
The point of what I was saying to you before was that not everybody has
access to good reference works. For many people, this echo _is_ their
reference library. It's how they get hold of new algorithms and learn.
BB> I keep trying to drop out. :-)
I haven't even gotten involved in that part. I've only done a couple of
messages pointing out that theoretical results aren't always reliable
(and I took pains to say I didn't want to get involved the numbers
etc.), and that not everybody has access to Knuth.
--- QScan/PCB v1.19b / 01-0162
---------------
* Origin: Jackalope Junction 501-785-5381 Ft Smith AR (1:3822/1)
|