Saturday, March 28, 2015

Reflections on blog about tracing recursion

On the 5th week of CSC148, I wrote a blog about my impressions and my experience regarding tracing recursion. For this week's blog, I will provide my thoughts on how my impression of recursion changed as we went on with the course. I will also compare my experience in this topic with that of my classmates and my friends.
When we were first introduced to recursion, the concept of it simply befuddled my mind. I had no idea about what it was, how it worked and how important it was in the field of computing. Just to refresh your mind, recursion is when you call a function within the same function. Pretty strange, isn't it? That's exactly what I thought. So at time, I vowed to myself that I'll simply learn how to trace recursive code in order to succeed in the exam and from then onward, I'll never even come near this topic again. I had a similar conversation with my friends and out of frustration regarding not being able to understand recursion properly, we all agreed. I simply thought that recursion is one of the many programming techniques we'll learn and that there are many more (possibly easier) solutions to it. I underestimated its importance but friends, I could not have been more wrong.
Starting from week 6, we started learning about tree data structures. I was excited about learning a new concept, but what really surprised me was the amount of recursion involved in each and every function. When we created the tree class, everything from small functions such as repr, str to functions that show whether a number is present in any node of the tree or not, recursion was there. Furthermore, we moved on from simply tracing recursive functions and code to writing our own recursive functions. Personally, it was a difficult experience for me since it was a whole new leap from the work that we previously used to do. However, after hours of dedication and concentration, I started getting the hang of writing recursive code. I went on and did more research on tree data structures, when I came to realize that it had vast applications in may fields, especially in the field of artificial intelligence. Since it is the field of my interest, I had to understand the fact that understanding recursion and writing recursive code is mandatory for me.
Furthermore, for our second assignment, we had to implement a strategy called minimax in a game of tippy where the computer selects the best possible output given the game state and the circumstances. When I started to work on the program, I realized that the only way to solve this problem in a short and efficient way was by using recursion. Now I'm not saying that recursion can't be substituted. Functions that are made easier with recursion can also be done manually. However, the program would be extremely long, messy and hard to understand for yourself and your peers. That's something you wouldn't want if you want to succeed in programming in the future. Since I was working alone, I couldn't discuss with my partners regarding the assignment. But after the due date, I had a discussion about it with my friends and we all came to a unanimous agreement that we had underestimated the importance of recursion in the field of computer science. 
Now, my opinion of recursion have completely changed. I've realized that by substituting manual code with recursive code, you make the function shorter, more efficient and less likely to produce errors. Now at this stage, whenever I encounter a problem in programming, I try to see if I can solve the problem using recursion. I know that for those new to recursion, it is a difficult concept for many of us, but I can't stress how important it is to everybody and the only way to succeed in it is by practicing a lot. If you encounter problems, don't forget to ask for help when it is all around you. Finally, to understand more about recursion and how to trace them, you can check out the link http://looralicsc148.blogspot.ca/2015/02/week-5-tracing-recursions.html. Here, the person has given a detailed explanation on tracing recursion. Well, that's pretty much it for this blog. I hope you'll find it informative. I'll see you all next time. Until then, stay awesome and keep coding. Bye.

No comments:

Post a Comment