data structures using howeverrecursive solutions are not always the best solutions in some casesrecursive programs may require substantial amount of run-time overhead thereforewhen implementing recursive solutionthere is trade-off involved between the time spent in constructing and maintaining the program and the cost incurred in running-time and memory space required for the execution of the program (step (step (step (if there is only one ringthen simply move the ring from source to the destination (step (step (step (if there are two ringsthen first move ring to the spare pole and then move ring from source to the destination finally move ring from spare to the destination (step (step (step (step (step (step (step (step (consider the working with three rings figure working of tower of hanoi with onetwoand three rings whenever recursive function is calledsome amount of overhead in the form of run time stack is always involved before jumping to the function with smaller parameterthe original parametersthe local variablesand the return address of the calling function are all stored on the system stack thereforewhile using recursion lot of time is needed to first push all the information on the stack when the function is called and then again in retrieving the information stored on the stack once the control passes back to the calling function to concludeone must use recursion only to find solution to problem for which no obvious iterative solution is known to summarize the concept of recursionlet us briefly discuss the pros and cons of recursion the advantages of using recursive program include the followingrecursive solutions often tend to be shorter and simpler than non-recursive ones code is clearer and easier to use recursion works similar to the original formula to solve problem recursion follows divide and conquer technique to solve problems in some (limitedinstancesrecursion may be more efficient