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 create a new YouTube channel (NightHawk) for gaming purpose like online games streaming or games review.
We need some time for make video tutorials (CodeX) so, stay with us and keep supporting and you know already we make a Collaboration with HackIsOn YouTube channel long time ago So, please Subscribe Our Channels
Protection died IPs active, this IP range is not allowed !