[Coco] 6809 example
Roger Taylor
rtaylor at bayou.com
Sun Jan 18 00:27:59 EST 2004
At 12:06 AM 1/18/2004 -0500, you wrote:
>Roger Taylor wrote:
>
>>At 01:50 PM 1/17/2004 -0500, you wrote:
>>
>>>Note that even though the code is more complex, the speed is much much
>>>faster than the bubble sort. By implication this also means that if
>>>speed is your primary concern in picking a language, think again! The
>>>algorithm and quality of coding can be more important than the language.
>><snip>
>>>30 D=INT(2^INT(LOG(512)/LOG(2))-1)
>><snip>
>>
>>That looks like more than a handful for a beginner, especially the LOG
>>functions. I think a Hello World to stdout would be a very good 1st example.
>>
>>----------
>>Roger Taylor
>>
>That's true, but for the specific lesson shown the natural logs can be
>pre-calculated and the value of D, 255, used as a constant. The value
>should be based on N, where N is the number of items to be sorted. So
>strictly speaking the equation is
>
>D=INT(2^(LN(N)/LN(2)) -1 and N = 512 for the low res Coco screen.
>
>The algorithm comes from an article by Terry Barron in Byte, May 1983. It
>is also interesting to note that the author considers this only a medium
>efficiency sort.
Yep, sorting bytes in a table is quite fun. Sorting 1 gig of database
records is even more fun. :) I have a stack of computer science books
that I sometimes thumb through out of amusement just to see what experts
have come up with. It's wild. Some of these things I would have never
dreamed up (maybe, maybe not).
What should be another example is a search algorithm. I can search a 1-gig
zipcode database (from the HD) and find a record quicker than your finger
touches the ENTER key. This is with no index file, just the database of
records and nothing more. An interesting thing that I haven't tried is
something that most people totally forget about when figuring out ways to
create a searchable database... when it's possible, you can just map say,
a zipcode to an entry# of the same value, and there's no searching required
at all. The college CS book I have claims that this is the most unused and
most quickest search method under certain circumstances. There's no
telling how long people have scratched their head and never thought of
that. Ofcourse, there's a tradeoff between speed and memory consumption.
----------
Roger Taylor
More information about the Coco
mailing list