Article View: comp.sys.acorn.programmer
Article #22Re: Sorting algorithms
From: Martin
Date: Mon, 16 Nov 2026 19:17
Date: Mon, 16 Nov 2026 19:17
57 lines
3439 bytes
3439 bytes
In article <11dfi5o$1l3bi$1@solani.org>, Sebastian Barthel <naitsabes@freenet.de> wrote: > Am Wed, 11 Nov 2026 19:25:34 +0100 schrieb Meister Paul Sprangers: > > In article <5d3628e1b7News04@avisoft.f9.co.uk>, > > Martin <News04@avisoft.f9.co.uk> wrote: > > > >> 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). > > > > You're right, Martin. But it is deliberate indeed. I should have > > mentioned that the program sorts lines *alphabetically*, reason > > why it omits characters like spaces, hyphens, dots, colons etc. > > completely. > > > > I also left out ArmSort, because I wanted to show code that does > > it all by its self. > > > >> I suspect however that as FNcase tests each character 29 times, > >> it could be optimised. > > > > And even then I'm afraid that I would no longer understand it. > I don't understand what this line > IF dummy$(i%) < dummy$(i%-1) THEN > does. It compares two string - OK. But what is a string "bigger" > than another ? > It is a sort of hidden sorting ? If so, then there should > eventually be a variable that decribes the form of this sorting. A > to Z oder Z to A or Numbers included etc. No, it is not hidden. The word is not 'bigger' but 'higher' as in the ASCI values of each character are compared, so "A"<"B"<"C" etc. > To make this thing faster there (s)could be third array - with > numbers in it. This should be an integer array which points to the > text$ and dummy$ array, simply by numbering them as 1, 2, 3, 4 and > so on. To sort these one would do the same as in the progam shown, > but the SWAP isn't done in the string-array; only in the > integer-array. Every test needed is done by using the numbers in > integer-array as index-numbers into the strings. Should be a LOT > faster. No, it would be slower, because a SWAP of two strings in arrays already does exactly what you describe: it exchanges pointers to the strings, not the strings themselves. -- Martin Avison Note that unfortunately this email address will become invalid without notice if (when) any spam is received.
Technical Details
Message-ID:
<5d38c74a52News04@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> <5d3628e1b7News04@avisoft.f9.co.uk> <5d362f6206Paul@sprie.nl> <11dfi5o$1l3bi$1@solani.org>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: Mon, 16 Nov 2026 19:17:14 +0000 (GMT) Organization: None Lines: 57 Message-ID: <5d38c74a52News04@avisoft.f9.co.uk> References: <5d336712aebob@sick-of-spam.invalid> <5d3622ac84Paul@sprie.nl> <5d3628e1b7News04@avisoft.f9.co.uk> <5d362f6206Paul@sprie.nl> <11dfi5o$1l3bi$1@solani.org> Injection-Date: Mon, 16 Nov 2026 19:17:32 +0000 (UTC) Injection-Info: dont-email.me; logging-data="4035359"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19d64aTXD6GWFX8SqVJtsGQ"; posting-host="a3e7a48c2b476040f2bc420680462c73" User-Agent: Pluto/3.21a (RISC OS/5.31) NewsHound/v1.54 Cancel-Lock: sha1:HYN5Qsg0KgbEwVn0+TdRDv5b370= sha256:90q5/m7POAek1ENE/QlzKB/8G+Z5a2Nro/M4hoOMTAQ= sha1:cTINwcQgURCVi/TqkKDs2wc1wMc= sha256:MOUBqXPoXJEw5ZAKG6AAJxMm6B01k/HGCtBjf+krd9k=