Once this happens, the CPU executes a string of ret instructions until control returns to the original call to Recursive. So far, however, there hasn't been a real need for recursion. As it turns out, there are only a few recursive algorithms that you cannot implement in an iterative fashion. However, many recursively implemented algorithms are more efficient than their iterative counterparts and most of the time the recursive form of the algorithm is much easier to understand. The quicksort algorithm is probably the most famous algorithm that almost always appears in recursive form.
Recursion occurs at the last two if statements in the sort procedure.
Make room for i and j. Their use simply demonstrates the allocation of local variables on the stack. There is one thing you should keep in mind when using recursion - recursive routines can eat up a considerable stack space. Therefore, when writing recursive subroutines, always allocate sufficient memory in your stack segment. The example above has an extremely anemic 512 byte stack space, however, it only sorts 32 numbers therefore a 512 byte stack is sufficient.