Article View: comp.sys.acorn.programmer
Article #16Re: Sorting algorithms
From: Martin
Date: Wed, 11 Nov 2026 17:14
Date: Wed, 11 Nov 2026 17:14
43 lines
2866 bytes
2866 bytes
In article <5d3622ac84Paul@sprie.nl>,
Paul Sprangers <Paul@sprie.nl> wrote:
> I've written a short BASIC program that sorts the lines in a text
> file, taking capitals, undercasts and all sorts of diacritics, as
> well most other characters into account.
> My own example has nearly 6000 lines. The BASIC version took about
> 23 seconds to sort them, while the compiled version took less than
> 3 seconds to do the job. (On a 4té2 computer.)
> The text file is not included, but you should rename yours to
> "Texts" in order to let the program do its work. If your text file
> counts more than 6000 lines, you should change the DIM's in the
> program. Compile the program with the freely available !ABC
> compiler. Remember that the compiled version needs quite a big NEXT
> slot.
> There are much better or memory friendly ways to do this, but as an
> example it may have some use.
[Snip]
As a specific example, it works but does have some limitations.
The most obvious one is that any characters not included in FNcase are
omitted from the sort key completely (eg blank or hyphen). This may be
deliberate, but means it is not a plain sort.
If you load the ArmSort module, then PROCsort can be replaced simply
by the line
*Sort 1 a% dummy$(n) text$(e)
which probably saves time and effort.
The *Sort command may mean ABC cannot compile it, but I would be
interested to hear how the time compared without compilation.
I suspect however that as FNcase tests each character 29 times, it
could be optimised.
Martin
--
Martin Avison
Note that unfortunately this email address will become invalid
without notice if (when) any spam is received.
Technical Details
Message-ID:
<5d3628e1b7News04@avisoft.f9.co.uk>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<5d336712aebob@sick-of-spam.invalid> <5d3622ac84Paul@sprie.nl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Martin <News04@avisoft.f9.co.uk> Newsgroups: comp.sys.acorn.programmer Subject: Re: Sorting algorithms Date: Wed, 11 Nov 2026 17:14:34 +0000 (GMT) Organization: None Lines: 43 Message-ID: <5d3628e1b7News04@avisoft.f9.co.uk> References: <5d336712aebob@sick-of-spam.invalid> <5d3622ac84Paul@sprie.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 11 Nov 2026 17:14:55 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3399248"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+u0mhJ+u25fd9EvfA0QIPx"; posting-host="912b3a6b1cac8b2302dde165783f7aa9" User-Agent: Pluto/3.21a (RISC OS/5.31) NewsHound/v1.54 Cancel-Lock: sha1:g5rVuXDEGV8EVct67PD1HNnVz/8= sha256:W6Qgbac10Z63o8kqACxqpUo+5KjDMNheRIkIZ3EXn5s= sha1:ljgTT5c28450jCNKwZ4b9SV+UTA= sha256:WduOyG6LPJCpKJYSoJhSoaXxV6g5tZfy7GeFAJ3k6cg=