Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.acorn.programmer > #6735

Re: Sorting algorithms

From Sebastian Barthel <naitsabes@freenet.de>
Newsgroups comp.sys.acorn.programmer
Subject Re: Sorting algorithms
Date 2026-11-16 18:31 +0000
Message-ID <11dfi5o$1l3bi$1@solani.org> (permalink)
References <5d336712aebob@sick-of-spam.invalid> <5d3622ac84Paul@sprie.nl> <5d3628e1b7News04@avisoft.f9.co.uk> <5d362f6206Paul@sprie.nl>

Show all headers | View raw


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.


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.

At the end the output is generated by printing the strings as pointed to 
by the now sorted index-numbers in ascending from 0 to top in the integer-
array.


-- 
abra-ka-da-bra , mumble , mumble , wau , miau - swoosh und wech

Back to comp.sys.acorn.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Sorting algorithms Bob Latham <bob@sick-of-spam.invalid> - 2026-11-06 08:45 +0000
  Re: Sorting algorithms Jean-Michel <jmc.bruck@orange.fr> - 2026-11-06 17:30 +0100
    Re: Sorting algorithms Bob Latham <bob@sick-of-spam.invalid> - 2026-11-06 17:57 +0000
      Re: Sorting algorithms Jean-Michel <jmc.bruck@orange.fr> - 2026-11-06 20:28 +0100
  Re: Sorting algorithms Paul Sprangers <Paul@sprie.nl> - 2026-11-07 13:36 +0100
    Re: Sorting algorithms Jean-Michel <jmc.bruck@orange.fr> - 2026-11-07 18:55 +0100
      Re: Sorting algorithms Paul Sprangers <Paul@sprie.nl> - 2026-11-07 19:41 +0100
        Re: Sorting algorithms Martin <News04@avisoft.f9.co.uk> - 2026-11-07 19:48 +0000
          Re: Sorting algorithms Bob Latham <bob@sick-of-spam.invalid> - 2026-11-08 12:13 +0000
  Re: Sorting algorithms Paul Sprangers <Paul@sprie.nl> - 2026-11-11 17:06 +0100
    Re: Sorting algorithms Martin <News04@avisoft.f9.co.uk> - 2026-11-11 17:14 +0000
      Re: Sorting algorithms Paul Sprangers <Paul@sprie.nl> - 2026-11-11 19:25 +0100
        Re: Sorting algorithms Sebastian Barthel <naitsabes@freenet.de> - 2026-11-16 18:31 +0000
          Re: Sorting algorithms Paul Sprangers <Paul@sprie.nl> - 2026-11-16 20:15 +0100
            Re: Sorting algorithms Bob Latham <bob@sick-of-spam.invalid> - 2026-11-17 09:11 +0000
          Re: Sorting algorithms Martin <News04@avisoft.f9.co.uk> - 2026-11-16 19:17 +0000
    Re: Sorting algorithms Jean-Michel <jmc.bruck@orange.fr> - 2026-11-11 20:36 +0100
      Re: Sorting algorithms Paul Sprangers <Paul@sprie.nl> - 2026-11-11 22:55 +0100

csiph-web