Sunday, 5 April 2015

Week 12 - Final Impressions

    CSC148 has been my favourite course this term, so I'm sad that it has come to an end. Although I initially found the course to be much more difficult than CSC108, I can proudly say I overcame all of my difficulties.

    There were many challenging concepts taught in this course, mainly recursion and trees. Recursion seemed fairly straightforward until trees were introduced. Trees were so confusing to me for many weeks. I had no idea how to traverse a tree for quite a while. Needless to say, I couldn't collect a node's data during a tree traversal since I couldn't even traverse a tree. Going to the CSC Help Centre the week before the strike happened was one of the best decisions I made for myself. The TA I talked to was so helpful and after talking to him I could finally traverse trees. However, I had a bad habit of only being able to use list comprehensions to do recursion with trees. Thankfully, I broke out of this habit for assignment three as I learned how to unpack a list comprehension into a few lines of code. This also allowed me to use a different data type from a list which was helpful for assignment three since sets were required. Although I found it annoying that sets had to be used, this requirement is what led me to be able to write recursive functions that weren't reliant on a list comprehension.

    Overall, this course was extremely fascinating as were the professors. Looking back now, I don't think CSC148 is too difficult of a course at all as long as you keep up with the lectures and lab exercises. But most importantly, get help when you need it!

Sunday, 29 March 2015

Revisiting My Early Impressions of CSC148

    This week's assigned topic is to revisit an earlier SLOG post. I'll be revisiting my second post. In this post I discussed my problems with writing functions. In February, I frequently wrote my function body before the docstring, which went against the function design recipe. However, I have improved from then since I now can picture what a docstring might look like before I write the body.

    I also mentioned how I found recursion to be a difficult concept. While this is still true now, I have a much better understanding of recursion after lots of practise with writing recursive functions. For example, I was often lost with how to write the body during many of the labs and I couldn't understand what to do until I saw the lab solutions. But today I was able to write the function grow for assignment three, although it took a few hours. My hope is to master this concept before the final exam.

    Looking at this slogger's post, I know I'm not the only one who still has some trouble with recursion. I found it difficult, as did this slogger, to use recursion together with trees. For a long time I didn't know how to traverse through a tree using recursion and I also found it very difficult to recursively build a tree for assignment three. The examples in lecture made sense, but I wasn't keeping up with the lab exercises during the strike so I fell behind on the course work. Of course I only have myself to blame, for not keeping up with the work, but I have caught up on all the material as of now.

Sunday, 22 March 2015

Impressions of Week 9

    In this week's lecture, we reviewed the insert and delete functions for a binary search tree. Neither of these functions were new as they had been in our previous lab exercises but I appreciated the review since there was also a test this week.

    I found the first question for this term test to be the most difficult. It was obvious to me that I had a poor understanding of how nodes formed a tree as I was very unsure of what the maximum and minimum height of a tree could be given a certain number of nodes. So I will make sure to review trees properly so that I don't make the same mistakes again on the exam. However, the other two questions seemed fairly straightforward. Although I am worried I might have made a few careless mistakes, this test was fair. Like this slogger, I made sure to take advantage of my aid sheet for this test unlike the first test and it was extremely helpful. Even though I hardly looked at my aid sheet, since I knew and understood what was written on it, the process of creating it was a good study habit. I am considering making aid sheets for my other courses as another way to hammer important information into my brain.

Sunday, 15 March 2015

Impressions of Week 8

    This week we learned about linked lists. I found linked lists to be an easier concept to learn than trees since the structure is somewhat linear as each node in a linked list has a reference to the next node unlike in trees where each node might have a left or right child. This week's lab exercise was easier to me than week seven's most likely because I am more comfortable with linked lists than I am with trees.

    However, I am not entirely comfortable with the first approach for linked lists via lists made up of an item/value and a sublist. It doesn't as intuitive to me as the node class and wrapper class for a list approach to creating a linked list. I will have to go through the lecture slides again to understand this approach better.

Sunday, 8 March 2015

More Impressions of Week 7

    This week we learned about binary search trees which are different from regular trees. In a binary search tree the data is comparable and the data in the left subtree are less than node.data while the data in the right subtree are more than node.data. This makes a tree easier to traverse since it is sorted in a sense. For example, if you were looking for a node with a certain value you would know how to look for it from the root since the left subtree contains data that is lesser and the right subtree contains data that is greater. Hence you wouldn't waste time looking at all children in the tree.

    We also learned about three different tree traversals called inorder, preorder, and postorder. These traversals done by recursive functions and the nodes in a tree are visited as follows in the image below:

1 represents the first node that is visited, 2 the second, and 3 the third.

    As I mentioned last week, I found week seven's lab exercise to be much more difficult than previous labs. I am pleased to know that a fellow slogger also had difficulties with list_between and list_internal_between like I did and was able to solve his/her problem. I had the same issue of trying the write one line of code in my else block to make the two functions work. Fortunately, by seeing a TA at the CSC Help Centre, I realized that not all functions can work with just one line of code in an else block. By writing a few more lines of code I was able to make both of those functions work.

Sunday, 1 March 2015

Week 7

Note: I would like my TA to mark my post about object-oriented programming.

    This week's lab was more challenging to me compared to labs from previous weeks. I thought I had understood trees well enough, but I struggled to get list_between and list_internal_between working until just before the quiz began. I didn't feel that I did well on the quiz either, so I went to the CSC Help Centre, for the first time, later that day. The TA who led the help session was extremely helpful to me and I understand how to recursively call a function involving trees much better now.

Sunday, 22 February 2015

Reflecting on Term Test 1

    I think it's funny that I talked about NotImplementedErrors and method overriding in my previous post, and that they are what caused me to lose a lot of marks on the first term test. I completely forgot that NotImplementedErrors should be in the parent class and I instead wrote code that was specific to a subclass in the parent class. This was a major mistake and it caused me to do much more badly on the test than I would have had I used NotImplementedErrors and overridden the methods in the UndergraduateStudent subclass. But it's a lesson well learned.