Efficiency of Recursion
In general cases, a non-recursive program runs more efficiently than a recursive program since a recursive program requires more execution time to enter and exit from a function.
Recursive programs flows directly from the definitions and are easy to implement while a corresponding non-recursive program may involve expensive use of stacks which are difficult to develop and are more prone to error.
Recursive programs which doesn’t require any extra parameters or local variables usually require less execution time when worked on an efficient compiler even though some overload are involved, While a non-recursive program may involve expensive stack operations which usually outweighs the expense of overheads of a recursive version. So, in such cases, a recursive solution is most preferable.
Programs which does not require added machine efficiency could be implemented directly using recursion. But programs which have to be run more frequently and which requires greater run-time efficiency could be carefully converted to the non-recursive version by simulation using the recursive version with greater time and efficiency of the programmer.