Sunday, 2 March 2014

Recursion

This week we've been asked to discuss recursion. This was one of the earliest new concepts we have been introduced to in csc148. Essentially recursion is an efficient way to process information that is built up from small information of the same structure as the whole. In a recursive function we define a base case which is the smallest structure of information the function will process and this is where the actual use of the function takes place. If we have information that can be considered as being made up of a the base structure of information the function will call itself with a reduced version of the initial information (say by one base case). If this reduced version of the original information is still built up of the smallest structure of information the function will then call itself again. This will repeat recursively until all of the information can be processed in terms of the base case.

I have found recursion to be the most compelling and exciting in computer science so far. I sort of stumbled on this notion during last semesters csc108 but could not really make proper use of it. After learning the proper technique of recursive functions in csc148, I've realized how useful this concept really is. In theory, this very simple concept can allow for the processing of information of infinite depth. Although writing recursive functions can be tricky to wrap your mind around at times this incredibly powerful idea can be implemented in Python function is such surprisingly simple way. The power along with the simple form a recursive function can take is really extraordinary.

No comments:

Post a Comment