2014年2月27日 星期四

Recursion

Have been talking about recursion from the begging of the semester and we have learnt a lot about recursion already. Recursion is basically calling the function again and again within the same function. Using recursion can help to break a complex problem down into smaller and simpler ones; getting smaller and smaller sub-functions until the problem can be solved.











The most simple problem is to sum up the integers in a nested list, other examples are Tree and LinkedList.









Using recursion really helps to solve "BIG" complex problems.

沒有留言:

張貼留言