[fpc-devel] Sorting tests

Marco Borsari borsa77 at libero.it
Fri Nov 25 11:10:49 CET 2022

On Thu, 24 Nov 2022 18:51:12 +0000
"J. Gareth Moreton via fpc-devel" <fpc-devel at lists.freepascal.org> wrote:

> Hi everyone,
> I just need to touch on the knowledge base.  What tests exist that test 
> the functionality of rtl/inc/sortbase.pp?  As Olly suggested, I'm 
> looking at creating Introsort for this unit as well, but I need to know 
> if such a unit already exists or if I need to make my own.

Some times ago I wrote a couple of merge sort routines to use in BWT,
the project never goes further so they remain at level of numerical
values input only.
They should have a good worst case scenario.
In the merge.pas the parameter nrm has to be false when the dimension
of the array is not a power of two.
There also is a check head-tail of the blocks to move in a single pass
the smaller one.
The natural.pas is recursive in the initial division in blocks and allow
for adaptation for inputs already sorted.
If you find them useful, you are free to made anything you want.

Simplex sigillum veri
-------------- next part --------------
A non-text attachment was scrubbed...
Name: merge.pas
Type: text/x-pascal
Size: 2641 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20221125/f6f57889/attachment-0002.pas>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: natural.pas
Type: text/x-pascal
Size: 1926 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20221125/f6f57889/attachment-0003.pas>

More information about the fpc-devel mailing list