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


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

Re: Sorting algorithms

From Martin <News04@avisoft.f9.co.uk>
Newsgroups comp.sys.acorn.programmer
Subject Re: Sorting algorithms
Date 2026-11-11 17:14 +0000
Organization None
Message-ID <5d3628e1b7News04@avisoft.f9.co.uk> (permalink)
References <5d336712aebob@sick-of-spam.invalid> <5d3622ac84Paul@sprie.nl>

Show all headers | View raw


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. 

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