![]() |
|
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) |
RE: Challenge 9 - Quick sort - AbsoluteBeginner - 11-05-2024 (11-05-2024, 03:14 PM)litdev Wrote: Sorting is an extremely well researched topic and extremely unlikely any of us will discover anything new that works well. But that isn't the point, the point is researching something, thinking about it and writing code, testing the code and comparing it with other methods objectively. So by all means, share your variants or maybe try to write the quicksort as originally suggested. (translated by Google translator) In that case, I will continue preparing my code for publication. Because it is interesting.
RE: Challenge 9 - Quick sort - AbsoluteBeginner - 11-07-2024 (translated by Google translator) Hi all. My fear is growing that I won’t be able to sort an array of 1024 elements in 9...10 passes. I haven't explored everything yet, but at this point, I need twice as much. Eh, it's a pity that I have little free time. But, on the other hand, I am very lucky that I have Small Basic. Using any other programming language that is more complex than Small Basic, I would be too lazy to do these experiments.
RE: Challenge 9 - Quick sort - AbsoluteBeginner - 11-11-2024 (translated by Google translator) Guys, I knew this existed ! I finally found a way to quickly sort any array using my "box sort" method ! I don't have the opportunity to describe this method now. But, on the other hand, I have the opportunity to share with you the pleasure that I have made my personal discovery. It's night here now. See you later. RE: Challenge 9 - Quick sort - AbsoluteBeginner - 11-12-2024 (translated by Google Translate) Hello everyone. Here is the solution that suddenly became obvious to me. As you remember, my previous solution is that the value of an integer random number was used as an index of this number in the sorted array. But, until yesterday, this method did not allow using arrays that contained fractional values or values that were larger than the size of the original array. Last night, I saw in my mind's eye that if we use not the entire fractional random number as an index, but, for example, only the two left symbols of this number, then we get an INTEGER index of the auxiliary array of "boxes". We place this entire number in the "box" with this index. In this case, for all random numbers of the original array, the two left symbols must be used, which correspond to the same decimal places. For example, if the array contains the numbers 123.4567 and 1.2345, then the two-digit index of the "box" for the first number will be 12, and for the second number = 00 (001.2345). After all the random numbers of the original array are placed in the corresponding "boxes", we simply repeat this operation for each "box" that contains more than one number (we will create "boxes within boxes"). But this time, we use the next two symbols of the random numbers (for the number 123.4567 = 34 and for the number 001.2345 = 12). This is the solution I have now. I don't have the code yet. But you can write your version of the code until I publish mine. RE: Challenge 9 - Quick sort - jrmrhrb00 - 11-18-2024 Here is Quick Sort using Small Basic Stack Functions. Creates a thousand random variables and then sorts them. PFNR733.000 JR RE: Challenge 9 - Quick sort - AbsoluteBeginner - 11-18-2024 Hello, JR. ![]() I'm interested to know your sorting option. Thank you.
RE: Challenge 9 - Quick sort - jrmrhrb00 - 11-18-2024 AB, I don't know what you mean by sorting option. It is just quick sort. Sorting is basically done via the sub "partition" and the indexes are tracked via the small basic stack. If you want to figure out how it works analyze the partition function. This was originally generated by copilot using a stack. I changed it to using small basic stack functions. JR RE: Challenge 9 - Quick sort - AbsoluteBeginner - 11-18-2024 (11-18-2024, 12:54 PM)jrmrhrb00 Wrote: AB, (translated by Google translator) JR, Google translator made such a translation of my words, which meant “one of the possible ways of sorting” (sorting option). It's really interesting to see how people use AI when creating code. A person is as strong as the amount of energy and matter of Nature he can use to achieve his goal. I first brought this to my attention many years ago when I watched the movie "Rambo 2" ( Rambo in Vietnam ). Now it's time to use AI.
RE: Challenge 9 - Quick sort - Scout - 11-22-2024 I included JR's Quicksort algorithm in the sort demo. Program ID: JCXS148.000-0 Unfortunately, a box remains in the upper left corner when the first larger block is moved ![]() Maybe someone can find the error? ?
RE: Challenge 9 - Quick sort - jrmrhrb00 - 11-22-2024 Scout. Pretty amazing. I wouldn't of thought there was so much variation in sorting times. I'm still looking for that block you mentioned. JR |