In this week’s class, we started to dig deeper into recursion functions, which I mentioned in my last post. This was a challenging concept to grasp at first. After practicing a lot of tracing exercises for recursion in class and in tutorial, I have definitely gained a better understanding of this function. When a recursion function is called, the function clones itself to make copies of its code, local variables, and parameters. There was an interesting example of recursion I came across while reading online. Imagine that the surfaces of two mirrors are exactly parallel with each other, then the nested images that occur are a form of infinite recursion. However, recursion doesn’t necessarily make the code run faster, nor does it use less memory, but it sure makes our code simpler and more concise.
In this week’s tutorial, we were able to do some exercise problems associated with stacks. I was able to implement my own recursion function to solve the problems and was surprised when it worked. My function gave the right results according to the examples assigned. However, I came to realize that I do not have a concrete understanding of recursion because I struggled while implementing them.
In the mean time, I am looking forward to reading week which is when I have more opportunities to review this topic.

No comments:
Post a Comment