Monday, 14 October 2013

Recursion

Today's post is on recursion! This was a mind screw for me at first but now I get the concept(and the coding!) In Python recursion involves a function calling itself. Like while or for loops, recursion can be controlled.

Recursive functions can accomplish the same things as loops. They require more memory and are less efficient in a lot of cases. Then why learn / use them in the first place right?  There ARE some cases when these functions are in fact appropriate and more effiencient. When solving complex problems, a recursive functions can break down the steps in to smaller more manageable ones(less mind screwing)  and make it easier and simpler code.

P.Jiggly

No comments:

Post a Comment