[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Low-level vs. High-level programming (was My First Computer)
- Subject: Re: Low-level vs. High-level programming (was My First Computer)
- From: mjmahon@aol.com (Michael J. Mahon)
- Date: 19 Jun 2003 19:50:58 GMT
- Newsgroups: comp.sys.apple2
- Organization: AOL http://www.aol.com
- References: <bcsp35$ov7$1@merope.saaf.se>
- Xref: archiver1.google.com comp.sys.apple2:31503
Paul Schlyter wrote:
>In article <bcs938$sbn$5@titan.btinternet.com>,
>Kevin Lawton <kepla@btinternet.com> wrote:
>> Paul Schlyter <pausch@saaf.se> wrote:
>>| In article <bcqv6a$d0a$4@sparta.btinternet.com>,
>>| Kevin Lawton <kepla@btinternet.com> wrote:
<snip>
>> A bubblesort is more suited to working on reasonably small numbers
>> of items.
>
>But of course..... :-)
This reminds me of an amusing story...
Many years ago, I had a need to sort a large data set that nearly filled
the memory of the machine at my disposal. I had the good fortune to
be at the same school at which Don Knuth was currently teaching, so
I decided I should ask him for advice about sorting algorithms.
He told me that there were at that point, 28 different sorting algorithms
(after filtering out equivalent algorithms), and that the curious thing was
that each of them was "best" in some situation--execept one.
Bubble sort was never the best algorithm to use for sorting, regardless
of data set size. However, he went on, bubble sort was apparently the
most "intuitive" sorting algorithm, the one "invented" by most people
when asked to write a sorting algorighm, and so it was the "best" for
teaching people _about_ sorting algorithms! ;-)
(BTW, for very small numbers of items, the "repeatedly pick lowest
and set it to infinity" algorithm ("pick and zot") is usually the fastest,
although it is exactly n**2.)
-michael
Check out amazing quality 8-bit Apple sound on my
Home page: http://members.aol.com/MJMahon/