We call an object recursive if it contains itself, or if it is defined by itself. Recursion is a programming technique in which a method makes a call to itself to solve a particular problem. Such methods are called recursive.
The calculation of factorial is often given as an example when explaining the concept of recursion, but in this case, as in many others, recursion is not the best approach. Very often, if we are given a recurrent definition of the problem, the
recurrent solution is intuitive and not posing any difficulty, while iterative (consecutive) solution is not always obvious.
In this particular case the implementation of the iterative solution is as short and simple, but is a bit more efficient:
If the algorithm solving of the problem is recursive, the implementation of recursive solution can be much more readable and elegant than iterative solution to the same problem.
Note : Recursion is powerful programming technique, but we have to think carefully before using it. If used incorrectly, it can lead to inefficient and tough to understand and maintain solutions.
We Are Currently Working On Our Android Application Development and We already have two YouTube channels their name is CodeX or NightHawk. CodeX is for programming related videos and NightHawk is for online game streaming so please supporting us and Subscribe to our channels, Thank you