We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Challenge 9 - Quick sort
#51
(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.
Reply
#52
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
Reply
#53
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

   
Reply
#54
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
[-] The following 2 users Like Scout's post:
  • AbsoluteBeginner, jrmrhrb00
Reply
#55
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



   
[-] The following 1 user Likes Scout's post:
  • AbsoluteBeginner
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)