Friday, 27 February 2015

Summary of Recursion

    Recursion is certainly my favorite programming concept that we have covered this semester. This being said, beginning with the suggested style of tracing recursive code was much harder for me to wrap my head around than the code itself and I have since developed my own methods. Combining recursive code with list comprehensions was also somewhat easy for me and seemed quite logical. After a small amount of practice with writing basic functions using these ideas, both the lab exercises and our weekly quiz were exceptionally easy for me.

    Although I already posted about my thoughts on the combination of recursive code with trees, I feel that this topic is certainly worth revisiting in light of Assignment 2. As I mentioned in my last post, I generally spend a great deal of time studying the lab exercises before each weekly lab, I found this to be crucial in aiding my understanding of recursion with trees. The abstractness of this concept, although quite interesting, was very challenging for me to wrap my head around and I found that learning at home at my own pace with no time constraints allowed me to fully grasp these ideas. The true test of my abilities was the Minimax algorithm (in Assignment 2), even with my solid understanding of recursion with trees, I still found this to be extremely challenging. After roughly 5 hours of drawing pictures, madly typing code, and consuming large amounts of caffeine, I managed to fully complete Minimax and I feel that I have become a much stronger student as a result.

    Moving on to my first impressions of binary search trees, I find this concept somewhat challenging but not exceptionally difficult. With my relatively strong understanding of recursion in non-binary search trees and my study strategy of completing lab exercises at home, I am just starting to become more comfortable with writing functions that complete various tasks involving these objects. I certainly will need more practice beyond the Additional Exercises in this week's lab, so I may spend some time this weekend rewriting all of my solutions to lab #6.

These are my solutions to the Additional Exercises in Lab #6 (with corrected docstring examples). If anyone finds any bugs, please let me know in the comments.

7 comments:

  1. Hi there again,

    Great blog post! I definitely like your approach for going into each lab. Since I'm enrolled in the evening section, I used to wait until Wednesday night to look at the handout. Unfortunately, I spend no time between then and my lab actually working on the handout since I work all Thursday morning. But last week, I decided to go to the morning section to ensure I got a few days to work on the lab handout, and I was able to get my doubts cleared before my lab.

    As for your code, I just have one suggestion for the count function, if you don't mind me saying so. You don't need that elif statement since you have already covered cases where the BTNode is empty. When you execute that else statement, the sum of 0, 0, and 1 is returned, which is obviously 1.

    Good luck with A2!

    ReplyDelete
    Replies
    1. You're right, thanks for pointing that out! I think for this week, if the TA strike is still happening, I will post all of my solutions to the lab exercise. I would be happy to compare my solutions with yours if you are willing to post them.

      Delete
    2. No problem :) I have linked my solutions in my blog 7 post. Since I completed the exercises before going to the lab, my TA was able to give feedback on my solutions. https://csc148winter2015.wordpress.com/2015/02/26/week-7-required-post-implementing-recursive-functions/

      Delete
  2. I would definitely love to compare answers for this week's lab! I should have solutions posted by the end of this week :)

    ReplyDelete
    Replies
    1. Great! :) My solutions can be found here http://pastebin.com/YFR5Qud3
      (I fixed insert_before)

      Delete
  3. Nice Job! can you also post the solutions for the lab06 exercises? specially the list between functions?that would be awesome!:-) keep up the good work

    ReplyDelete
    Replies
    1. For sure,
      http://pastebin.com/bsYvaZGc
      (I did the evaluate function in a different exercise)

      Delete