Think about how to define subproblems concisely and store them on the stack. You then can use a while loop to process problems from and to this stack. Also, please see the chapter discussion about in-place quick-sort for more hints.