Quick Sort
Quick Sort
The program Quicksort.raw sorts numbers in registers 0 to 99. On program line 11 is the size (100 = registers 0 to 99). You can use the program Filla.raw to fill registers 0 to 99 with random numbers. If you do XEQ Q9, it will put the random numbers into matrix MM, which you can edit to view numbers. To sort the numbers, do XEQ QS. You can edit matrix MM again to view the sorted numbers. If the numbers are sorted already and you run quick sort again, it may fail, since Quicksort does not do well with a sorted set of numbers, since the pivot point is not ideal. This non-recursive algorithm is a public domain version by Darel Rex Finley. This implementation has not been optimized to use the fewest instructions - I just attempted to translate the code from a C version. I have also ported this to the HP 35s, if anyone is interested.
- Attachments
-
- quicksort.raw
- (445 Bytes) Downloaded 125 times
-
- filla.raw
- (50 Bytes) Downloaded 123 times