One of the new concepts in CSC148H (Introduction to Computer Science) come with a bit of a learning curve in terms of understanding. Recursion, as described in the CSC148H course notes (which can be found here (http://www.cdf.utoronto.ca/~csc148h/winter/148notes.pdf), is defined as an "...useful and beautiful problem-solving technique..." which is intriguing. As described in the course notes, we can break down a problem into several smaller problems, produce a solution to those problems, and combine those solutions into a solution for the original problem. For example, you wanted in the largest value in a list, but within a list you had sub-lists that consisted of various values. You would use recursion to go through each value at a specific index, and if that specific index contained a list, then recursion would permit you to go through each value in that list in order to get the value you wanted. The end result would be a list of values where the end-cycle of the recursion function would return the value that you wanted in the first place. For example, that could have been the max value of integers inside list.
The idea behind it is relatively simple, but not as easy to implement it. The tracing recursion exercises were integral in understanding how recursion works. It helps you understand how recursion works, and gives insight into proper recursion code. The initial expression is that it isn't that difficult to understand and implement, but time being spent on Assignment #2 will help provide a better understanding of that situation.
No comments:
Post a Comment