Is every recursive function convertible to iteration? What characteristic should a recursive function have in order for it to be implemented using iteration?
<
Like the other answers already stated, it's technically possible to do that with simulating the stack. But I guess you don't want to do that. You probably want an iterative solution without using a stack. If that's the case you need to have a tail recursive function. AFAIR that's the only possible way. You can rewrite every tail recursive function to an imperative one without simulating a stack.