Two more sorting algorithms

3 views
Skip to first unread message

The Beez

unread,
Dec 21, 2025, 6:38:57 AM (yesterday) Dec 21
to 4tH-compiler
Hi 4tH-ers!

You know I have a weak spot for randomizers and sorters. I recently found out I implemented a George Marsaglia three times. In different ways. Which is interesting in itself.

However, I was happy to find the "Foldsort" algorithm, which only does sizes of powers of two, because it bears a resemblance to "Circlesort" - an algorithm of my design.

I first coded it in uBasic/4tH - and then in 4tH. It pretty much ran first time.

I also designed "Runsort", which was designed to take advantage of already existing sorted sequences in things. But it's slower than expected - even after an effort to improve it.

Still, I improved it once more. Now it is about 16 times faster than the previous version, but still 100 times slower than "Circlesort". That is - with a completely random sequence. I haven't (sufficiently) tested it with partly sorted arrays. I guess the main thing is it uses *SMOVE* - which is about as fast as C.

Code in SVN.

Hans Bezemer
Reply all
Reply to author
Forward
Message has been deleted
0 new messages