Small Basic Forum
Challenge 9 - Quick sort - Printable Version

+- Small Basic Forum (https://litdev.uk/mybb)
+-- Forum: Small Basic (https://litdev.uk/mybb/forumdisplay.php?fid=1)
+--- Forum: Challenges (https://litdev.uk/mybb/forumdisplay.php?fid=5)
+--- Thread: Challenge 9 - Quick sort (/showthread.php?tid=152)

Pages: 1 2 3 4 5 6


RE: Challenge 9 - Quick sort - AbsoluteBeginner - 11-23-2024

(11-22-2024, 09:13 PM)Scout Wrote: ...
Unfortunately, a box remains in the upper left corner when the first larger block is moved
...
Maybe someone can find the error?

(translated by Google translator)

Hi all.

Scout,
Your program works without errors on my computer.

Besides, your program has given me back my interest in life. After the shelling of my city by an intercontinental ballistic missile, which the whole world is now talking about, I felt very bad.  Cry
But your program has given me my life energy back.

Now I will continue to create a program for my improved sorting method.

Thank you, my friends, for being you.


RE: Challenge 9 - Quick sort - jrmrhrb00 - 11-23-2024

Scout,

On my computer I don't see any thing wrong either. Also, interesting that sometimes the shell sort wins and sometimes it's quick sort.

JR


RE: Challenge 9 - Quick sort - Scout - 11-23-2024

Quicksort is strong when it comes to randomly arranged data.
The small differences to Shellsort arise from the specific arrangement of the random data.
Quicksort does not perform well when the data is pre-sorted. Shellsort handles both well.
Pre-sorting can be done for numbers from 255 down to 50 in steps of 0.2 as follows:

Code:
GraphicsWindow.BackgroundColor = "Gray"
sorted = 255
'set up random array'
For r = 0 To rows-1
  For c = 0 To columns-1
    'red = Math.GetRandomNumber(256)-1
    red = sorted
    sorted = sorted - 0.2  
    'green = Math.GetRandomNumber(256)-1

   


RE: Challenge 9 - Quick sort - Scout - 11-23-2024

Sort demo with 3 Colors and 768 different values

Program ID: JCXS148.000-1

With more different values Quicksort is now slightly faster than Shellsort


   

Since 256 values are still ambiguous, different representations occur due to the different algorithms


RE: Challenge 9 - Quick sort - Scout - 11-23-2024

Sort demo with 1024 different values

Program ID: JCXS148.000-2

With more different values Quicksort is now faster than Shellsort.

I used Nonki's Color_RGBtoHSL() to get a better color sorting with Hue.
Applying lightness and saturation might produce an even more harmonious rainbow.  Wink