Someone wrote:
"yes, I Had to do the Same, when I implemented Quicksort in REXX,
because
the OS/2 Implementation of REXX only supported some 32 nesting Levels."
The usual way to write recursive quicksort is to take advantage of tail
recursion.
Each call will generate two recursive calls for two partitions of the input.
One is done with an actual recursive call, and the other, which would
normally
occur just before return, is done with a branch back to the top.
This is tail recursion elimination.
If the smaller partition is done with a recursive call, it is guaranteed to
be smaller than half the input, so at most log2(N) levels of recursion.