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


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

Re: Sorting algorithms

From Paul Sprangers <Paul@sprie.nl>
Newsgroups comp.sys.acorn.programmer
Subject Re: Sorting algorithms
Date 2026-11-16 20:15 +0100
Organization None
Message-ID <5d38c72b71Paul@sprie.nl> (permalink)
References <5d336712aebob@sick-of-spam.invalid> <5d3622ac84Paul@sprie.nl> <5d3628e1b7News04@avisoft.f9.co.uk> <5d362f6206Paul@sprie.nl> <11dfi5o$1l3bi$1@solani.org>

Show all headers | View raw


In article <11dfi5o$1l3bi$1@solani.org>,
   Sebastian Barthel <naitsabes@freenet.de> wrote:

> 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 ?

A string is 'bigger' than another if it alphabetically comes after the
other one. "Sebastian Barthel" is bigger than "Sebestian Bach"!

The point is that BASIC only looks at the ASCII value of characters for
determining the alphabetical flow. Therefore it puts 'Céline' after
'Coline', for example.

The other point was that OP's original routine takes 12.7 seconds to sort a
list of over 4000 lines and still has the 'Céline' problem, while a simple
BASIC program (okay, compiled) sorts 6000 lines without that problem in
about 3 seconds.

But of course, this simple program can be enhanced a lot further in many
ways, one of which is sorting pointers rather than strings, as you already
pointed out.

Paul

-- 
https://riscos.sprie.nl

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