Data Structure Lab 7: What is Recursion | Loop vs Recursion and Application| Implementation in C++

Publié le: 18 octobre 2022
sur la chaîne: Engr Khuram Shahzad
90
3

What is Recursion?
The process in which a function calls itself directly or indirectly is called recursion and the corresponding function is called a recursive function. Using a recursive algorithm, certain problems can be solved quite easily.

Need of Recursion

Recursion is an amazing technique with the help of which we can reduce the length of our code and make it easier to read and write. It has certain advantages over the iteration technique which will be discussed later. A task that can be defined with its similar subtask, recursion is one of the best solutions for it. For example; The Factorial of a number.

Properties of Recursion:
Performing the same operations multiple times with different inputs.
In every step, we try smaller inputs to make the problem smaller.
Base condition is needed to stop the recursion otherwise infinite loop will occur.


Sur cette page du site, vous pouvez voir la vidéo en ligne Data Structure Lab 7: What is Recursion | Loop vs Recursion and Application| Implementation in C++ durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Engr Khuram Shahzad 18 octobre 2022, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 90 fois et il a aimé 3 téléspectateurs. Bon visionnage!