sort stack using limited instructions
The used algorithm globally works like quicksort, with some tricks to lower the instructions using the rr, rrr and ss instructions.
Here is a simplified version.
More here
- find instructions to sort a
- find instructions to sort b
- compress them using
rr,rrrandssinstructions
More here
- if len <= 3, then b last part should be less than or equal to 3 in len, so call sort_and_merge function and return
- push every values less than median to stack b
- call quicksort stack a
- call quicksort stack b
More here
- push every values more than median to stack a
- call quicksort stack a
- call quicksort stack b