I have decided to revisit last week's (week 10's) post, as it describes the continuing struggle I have faced with grasping and mastering recursion. I wish I could say my approach to learning recursion has been anything other than brute forcing my way through a problem until I obtain a correct answer, or learning through mimicry, but that would be a lie.
Recursion is the one concept in CSC148 that I have struggled with, and it is a fundamental concept that all programmers should have a strong understanding of.
In week 7 of this course, I defined recursion in my own words:
"""
Recursive functions are functions that call themselves. If a task can be divided into identical, smaller sub-tasks, this is a good indication that you can perform this task by recursion.
They have a conditional structure that specifies a base case (or cases): a condition (or conditions) that will stop the function from making calls to itself. The also have a general case, which specifies the method in which recursive sub-calls will be combined. Essentially, the general case is the part where the function calls itself. It is important that you designate a base case, or the function call will reach a maximum recursion depth, and result in a stack overflow.
What is this legendary stack you speak of? Recursion is actually a method of using stacks to achieve a task. However, call stacks are stored in a computer's memory, and these stacks cannot become infinitely large, as computers do not have an indefinite amount of memory space. Thus, when a recursive function has a bug, and never reaches a base case, the computer will eventually runs out of memory and crash the program. This is called a "stack overflow".
"""
I think recursion is definitely a concept that does not come easily to me. It will most probably be a concept that I gradually come to terms with as I grow as a programmer. It is certainly a new, and unused way of approaching a problem that I have never personally encountered prior to this semester.
I worry for myself, as I am concerned that I will not do well without having a fully understanding of recursion going into the exam and into 2nd year programming courses.Regardless, all I can do is try harder.
I think the one thing that keeps me afloat is realizing that my struggles are not unique to just me.
For example, here are a list of blogs that I have either read or commented on:
https://humaircsc148slog.wordpress.com/2015/03/15/week-9-back-to-bsts-insertions-and-deletions/comment-page-1/#comment-2 Humair takes time this week to describe Binary Search Trees and various methods associated with these classes. Humair always takes the time to write informative posts, and it's always informative to see how my peers approach different problems. Humair's blog has been a pleasure to read this semester
https://csc148winter2015.wordpress.com describes their journey with recursion, and how they developed over the period of a semester. Notably, the writer finds that they learned how to approach recursion in their own unique way.
http://christiangarciacsc148.blogspot.ca/2015/03/week-10-impressions-of-week-9.html?showComment=1427568192945 always takes the time to create clear and concise diagrams to help his peers understand topics. His posts are always informative. In one of his posts, he mentions a quote from a fellow student that he found guided him through his learning:
“I think the key concept is: don’t start [from] details but start from structure.”
He proceeds to state that: "This is definitely a good advice to take home. Structure is really important when programming. A clear structure can help not only the person coding, but people looking at that code. Also, having a plan before starting anything helps to clarify ideas and to have an easier time coming up with a solution."
I think, ultimately, that recursion is as complicated as you make it. I have to learn how to simplify problems. To not overthink things, and to take things slowly. Rather than coding desperately, and trying a billion solutions until I find the one that works, I should rather just sit down and pause. Think about the core problem I'm trying to solve, and let things fall into place.
I think one's approach to solving a recursive problem could actually be indicative of one's approach to solving every day problems.
I'm normally a highly stressed individual who sweats all of the details. I angst over the trivial technicalities, and fail to see the larger picture at times. I have long since come to recognize this problem, and I continually work to change this aspect of myself. Hopefully, as time passes, I will be able to apply a calmer, more methodical approach to solving problems both in my programming life and in my everyday life.