In high school, I remember the way we were introduced to recursion was through a comedic dictionary definition of recursion: "Recursion: See Recursion." XD
But now, in university, to get ourselves introduced to recursion, Danny Heap started off by introducing the idea behind recursion - which was to solve a problem by breaking the problem into smaller sets, and evaluating such from there on. It seemed a bit confusing at first, which was why Danny Heap showed us how recursion worked by tracing the steps involved in such.
Tracing recursion was not hard. In fact, the way they showed us this was 10 times easier than how they did in high school. I could remember in high school, none of my friends could understand the logic behind recursion, let alone 90% of my other classmates, because, despite my compsci teacher being great and all, we were just thrown into how to implement recursion without any background on how or why this worked. However, the way Danny Heap introduced us to recursive methods was clear, concise and, on top of all that, effective to grasp on your own. I had thought of recursion as a burden back in the past, but after Danny Heap's examples and ways of going around it I had never felt so excited about learning recursion before.
Granted, the recursion examples were simplistic, as we mostly performed recursion to do simple things such as getting the length of a list (with nested lists included), the sum of all elements in a list, and whatnot, yet the way they were explained to me was actually effective and well-performed. From what I understand, as we iterate through a series of elements, every time the recursive case was met, it would result in another method call on such an element until the base case was reached. From there, on each inner element the function would call itself until the base case was reached, where after that the recursion would settle itself, resulting in our final result. It was amazing, and I could confidently say that understanding the basics of recursion was one of the highlights of my week.
During our labs, we pretty much did the same thing again. The exercises were not that difficult, neither was the quiz; compared to the rest of the class I was able to finish my work early (after all, the work was not that much of a challenge) - maybe, after all this, recursion shouldn't be that bad after all, right? Only time will tell.
No comments:
Post a Comment