Article View: comp.sys.acorn.programmer
Article #5Sorting algorithms
From: Bob Latham
Date: Fri, 06 Nov 2026 08:45
Date: Fri, 06 Nov 2026 08:45
39 lines
2317 bytes
2317 bytes
A music library scan tool I've written produces a list of over 4000 lines, each line shows the path to a particular album. But the filer does not list in alphabetic order... There are two sort types I understand; Bubble sort and what I call "Best So Far" but I bet there is a different official name. I've always gone for bubble sort for two reasons, firstly I understand the principle and it does not require another chunk of ram to hold the result file. But using this method takes 12.6 seconds. The "Best So Far" method is to repeatedly pass through the source file and pick out the best line on each pass and move it out to another store and mark it as used in the source. I had the idea of squirting these best lines one at a time to a file on disc rather than provide temporary ram. I realised that using OS_BPut, line by line was not going to be as fast as saving a file in one go but tried it anyway. It took 6 seconds. Faster yes but I don't like it, the sorted file never exists in the application. True it doesn't matter but it kind of does to me. Anyone got any suggestions for a better approach? Something I might even understand? A slight complication, any sort would need to handle is the Céline Dion problem. I like treating é as e as regards the sort comparison stage. Also, how is StrongEd so lightning fast on sorts? It barely blinks. Still coded in Basic Assembler, in case you need to know. Thanks. Bob.
Technical Details
Message-ID:
<5d336712aebob@sick-of-spam.invalid>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mailShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Bob Latham <bob@sick-of-spam.invalid> Newsgroups: comp.sys.acorn.programmer Subject: Sorting algorithms Date: Fri, 06 Nov 2026 08:45:15 +0000 (GMT) Organization: None Lines: 39 Message-ID: <5d336712aebob@sick-of-spam.invalid> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: individual.net 4u4UuCIJfI9ZTvl0xVQGQAx20qMktxG6j28JVTVZu5CuQuUVe9 X-Orig-Path: sick-of-spam.invalid!bob Cancel-Lock: sha1:f4FPvDZ4SY5KdgJ7txGDemn8da4= sha256:mxO7pIxIWkPSmbEerTLvb/TLwc2/ybWFDg+WonxIVdA= X-No-Archive: Yes User-Agent: NewsHound/v1.54