Implement quicksort algorithm and sort
1000 random numbers.
Interesting to see if it's easier the usual way understanding the algorithm and writing the code or getting AI to do it for you?
This is a very interesting task.

Plus I'll be able to compete against my Copilot.
Hello everyone, friends.

QZVX574.000
Why doesn't this program work? It' just using LDArray.sort!
JR
(10-28-2024, 12:39 PM)jrmrhrb00 Wrote: [ -> ]QZVX574.000
Why doesn't this program work? It' just using LDArray.sort!
JR
Hello.
I think the program doesn't work because the LDArray.Sort() method is designed to work with arrays created by the LDArray.Create() method.
In my opinion, this method does not work with SB array.
Because these arrays are different from each other, the LDArray array works much faster than the SB array.
AB,
I agree with you in that it has to be a ldArray.
So, here's the updated program. Still doesn't work.
JXNC572.000
JR
(10-28-2024, 04:22 PM)jrmrhrb00 Wrote: [ -> ]AB,
I agree with you in that it has to be a ldArray.
So, here's the updated program. Still doesn't work.
JXNC572.000
JR
One of the errors:
status[i]=Math.GetRandomNumber(10)
There should be:
LDArray.SetValue(status, i, Math.GetRandomNumber(10))
I guess this is error

Code :
PHP Code:
'small basic array
For i = 1 To 10
name[i]=math.GetRandomNumber(10)
EndFor
'creates ldArray from indices
status=LDArray.CreateFromIndices(name)
TextWindow.WriteLine(status)
'loads ldarray with random numbers
For i = 1 To 10
status[i]=Math.GetRandomNumber(10)
EndFor
'why does the below fail
result=LDArray.Sort(status)
TextWindow.WriteLine(result)
'would give a listing of sorted numbers, but just shows them in their random order
For i = 1 To 10
TextWindow.WriteLine(status[i])
endfor
I just don't run the code got it from mobile.
What results this show:
PHP Code:
result=LDArray.Sort(status)
TextWindow.WriteLine(result)
And litdev extension api show for method:The input array is replaced by the sorted array
So after AB fix you have to make the last loop like this:
PHP Code:
For i = 1 To 10
TextWindow.WriteLine(LDArray.GetValue(status,i))
endfor
AB,Z-S,
None of the suggested fixes worked. I guess I'll wait on LitDev. He is always good at figuring these things out.
JR
(10-28-2024, 05:33 PM)jrmrhrb00 Wrote: [ -> ]AB,Z-S,
None of the suggested fixes worked. I guess I'll wait on LitDev. He is always good at figuring these things out.
JR
This is because we haven't fixed all the bugs yet.
Can you paste the latest version of your code into your new message?
AB, L-S,
I went back to basically the same code.
JR
JXNC572.000