Last week we talked about recursion and had a little practice in the lab.
Recursion means 'Defining something in terms of itself'. It works by calling itself for solving smaller subproblems.
It's very useful as without recursion, code can be very complicated, while recursion reduced the lines of code.
After practicing, I find myself comfortable with tracing a recursion. First of all, we work on the simplest example, and once we convinced about it, we can apply it in a more complicated case directly instead of breaking the complicated cases and tracing the subproblem of it again.
But I still have some problem writing the recursion and I'll keep practicing it.
No comments:
Post a Comment