Quick sort of list getting one number out of order, Suggestions?

This is a quick sort function. I didn't write it. I need to sort the list by any one of the 3 columns. It appears to be working with the exception of one single number in the third column. I was hoping someone might have some idea why this is not sorting by the 3'rd column.
ListSwapingTest.aia (3.8 KB)

After putting numbers into the first column i see it is misbehaving in a similar manner. One number is out of order.

ListSwapingTest (1).aia (4.1 KB)

AI2 has its own sort block.

It seems to work well.

I notice your quicksort is sorting numbers as text, not numbers.

20 < 3 for example.

It's easier to use a library function, unless you are studying the sort techniques.

Come to think of it, your sort comparisons are text based, disregarding the possibility that they should be comparing numbers:

1 Like

P.S. This is the second time today I have dealt with sorts that try to order numbers as if they were pieces of text.

When it rains it pours.

OMG! THANKYOU! I feel so stupid... Of-course I should be using a math function and not a string based comparison... (slaps forehead)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.