More on Recursion
A quick rundown of what we learned in the course. Hope you had fun taking this course!
We'll cover the following
A Final Note
In this course, we learned how to convert iterative code to recursive code as well as problem-solving using recursion.
Both recursive and iterative approaches can be used to solve a problem.
Recursive programs can be written iteratively and iterative programs can be written recursively.
However, the key is to choose the right approach in interviews until and unless stated specifically. Recursive programs have greater space complexity than iterative programs as all functions will remain in the memory stack until the base case is satisfied. However, recursion provides a clean and simple way to write code. It is easier to solve some problems recursively like graph traversals, Pascal’s Triangle, etc. For such problems, it is preferred to write recursive code.
We have come to the end of this course. We have covered all the concepts to get you started with performing recursion using Python.
Feedback
Your feedback, comments, concerns, and questions are always welcome! Drop us an email or a comment on the community forum. Looking forward to hearing from you!
Remember, practice makes perfect. So keep practicing the concepts we have learned in this course. Keep learning and have fun with it.
You can also learn recursion in other languages on our platform for example C++