Monday, 6 April 2015

Last impressions

It's the end of the term and the end of classes in my first year of university. It has been quite challenging for me, although the experience wasn't the worst. I'm glad I took computer science, as I have learnt and will continue to learn a lot in the field. Slowly and slowly, I've begun to see how it relates to real-life situations and problems.

As a continuation of CSC108, I feel like I began this course as if I had no background for it. We just happened to leap from 108 to 148, all of a sudden! I felt this way after seeing the first assignment and having no clue how to start it at first. Later, I started to see how it could be done. 

Overall, CSC148 has been very challenging for me, but it was worthwhile to learn. However, I didn't do as well as I had expected as I didn't ask for help enough from friends, professors, and TAs, and I feel like I didn't spend enough time practicing concepts learnt. Additionally, the TA strike proved to be a detriment to my learning experience, even though it gave me more time to complete work and review concepts. This is why I really struggled during the midterm tests and assignments, and even the labs that I'd done, as I didn't know how to apply the theoretical concepts. Hopefully, I will be able to do so in the final exam, and I plan to do all the labs, review course notes and other work, do past exam questions, and seek necessary help in order to prepare myself. I aim to do very well on the final exam, and also avoid silly mistakes, which I made on both of my midterm tests.

Despite the struggles, I really enjoyed going to lecture and learning the material. As well, the professor was very friendly, helpful and knowledgeable. He was also very funny, sometimes using humour to convey his message or to point out something. He explained the concepts very well, even using code and diagrams to demonstrate them where appropriate. He also gave his time, along with other professors, during office hours to help us with assignments and supervise our second midterm. As well, thanks to the professors, we were able to continue the course quite normally and not have any major disruptions in our schedule. The TA's were very helpful as well, they tried to use their knowledge inside and outside tutorials to help us understand concepts.

In second year, I will be doing Java instead of Python, so I think the experience may be a little different. But since I have programming knowledge in Java, I should be able to manage. I'm anticipating to use my Python knowledge as well in second year, but I am apprehensive of it. This is because the courses will only get more and more difficult, and more time and work will be needed in order to succeed in them. Hopefully though, I will be able to use my knowledge gained this year, along with additional resources, to succeed. 

Overall, I feel that our time in first year passed by so fast, and I wish I could go back and fix whatever mistakes I made in CSC108 and 148. But if I learn from my mistakes, that will be beneficial for me as well, given the fact that we can't go back in time.

Sunday, 5 April 2015

Week 11 - My first 4 weeks of CSC148 (Post 2)

In this post, I mentioned that the concepts that I learnt in these weeks weren't that difficult, but they weren't too simple either. I somewhat agree with this statement, as this is the case even now; the course concepts aren't too simple. In fact, the concepts have become more and more difficult to internalize, absorb, and above all, apply. The basic theory and code is quite easy to understand, but the application is the difficult part.

"The concepts are [relatively] easy to understand, but applying them requires a lot of thinking and can be difficult."

The world "relatively" is included here; it wasn't included in the original post, because now, I've realized that the course concepts have become more and more challenging to understand, despite being relatively easier than to apply. Because of this, I really struggled with the labs and the resulting quizzes, and even the assignments and midterm tests. 

I also mentioned that I planned to ask for help from various people, including TA's. I had planned to do this, but I haven't really been able to do it. This was because of other work that I had to do, and that I didn't really know what questions to ask them and how to. To be honest, I wasn't really sure of what I wasn't sure about, and also I didn't know how to verbally express what I didn't know. Additionally, the long TA strike had further limited my opportunities to seek help from TA's. So, I practically tried to figure out everything myself, with limited help from friends and TA's.

However, I do agree that I had looked forward to learning more advanced programming. This is true, because I tried to browse through the weekly lecture slides and code before every lecture, anticipating more new material. I really wanted to know what I would learn in lecture, and I wanted to be well-prepared. 

My situation is similar to this blogger, Niyant Hathi, in some ways: He mentioned that the course got difficult very quickly, and that things would get tough for him starting with recursion. However, he mentioned that he put in time and effort to understand the new topics. And even though marks are very important in the course, I completely agree with him on what he said about valuing what he learnt in the course than what some number says about his efforts in the course.

This is his blog post: http://niyantcsc148.blogspot.ca/2015/03/revisit-previous-slog.html

As well, I agree with Fahim Lallani, another blogger and my CSC148 classmate, about the importance of attending lectures. I feel that attending lectures in person are much more effective, than watching online lectures or listening to recorded lectures. He also mentioned that going to lectures would drastically improve his mark. My marks haven't improved drastically simply because of how much I struggled, but the lectures provided the foundations for my understanding of this course. Also, the professor explains concepts very well, and even outlines what needs to be done in assignments. Personally, I think that everyone should try to attend as many lectures as they can.

Fahim's comment about lecture attendance is in his most recent blog post: http://fahimscourse.blogspot.ca/2015/04/week-11-revisiting-earlier-blog-post.html

Friday, 3 April 2015

Week 10 - Mutating BSTs in Week 9

In week 9, we learnt how to mutate BSTs. Basically, mutating a BST involves adding nodes to a BST. To do this, we were shown a class BTNode and initialization of three variables: data, left and right. And then, the professor showed us some code that basically inserted nodal values to form a tree. This was done using the insert function. This code shows the implementation of the insert function:

return_node = node

if not node:
        return_node = BTNode(data)
elif data < node.data:
        node.left = insert(node.left, data)
elif data > node.data:
        node.right = insert(node.right, data)
else:
        pass
return return_node

At first, I found this code confusing to understand as I didn't understand why an initial variable was created. But I read it over and over again and I even drew diagrams to try and understand it. Finally, I understood the code and realized that it was just recursion that was "appointed" once again to insert nodes to the left or right of data.

                14
        12
                10
8
                 6
         4
                 
For example, if we were to insert a 2 into this tree, we would have to see if it passed certain conditions to determine where it should be situated. Firstly, there is a node here, so the base case is ignored. Then, we have to see if the data passed is less than node.data. In this case, is 2 less than 8? Yes, so we move it down the left side. Then, is 2 less than 4? Yes, so we situate 2 to the bottom left of 4. 

                14
        12
                10
8
                 6
         4
                 2

The same thing can be done for values larger than node.data, except then, the values would be shifted right in the tree. As for the deletion of data from a BST, we have to check for certain conditions to see where to delete data and shift previously attached data. 

This slog explain 3 cases encountered when deleting data from a BST. I found this explanation very helpful to understand on deleting data. It mentions about the base case, where only one node has to be deleted, a case where a node with only one child has to be deleted, and where recursion needs to be used in order to determine which data needs to be deleted. The person who wrote this slog also mentioned that this may not work when there are duplicate nodes. But one way to solve this is by passing the address of the node to be deleted, as the address of each node is unique. It was interesting to learn this important tip from this slog, and this is why I have included the link for it as well.

http://theremustbe.blogspot.ca/2015/03/week-9-mutating-bst.html

Thursday, 2 April 2015

Week 9 - Linked lists, iteration, mutation in Week 8

This week, we had our 2nd midterm test. It was actually not difficult, but I struggled with it as it required applying my knowledge of code for recursion. I don't think I did well in the test as I know that I didn't know how to implement the body of the classes given. This is because I found it difficult to apply my knowledge from lecture. It is easy to read code and a little tough to understand it, but it is a lot tougher to apply the knowledge.

After, the professor covered linked lists even further and showed us some code on how to "walk through" the linked list. I learnt two ways of thinking of linked list structures: as lists made up of an item (value) and a sub-list (rest), and as objects (nodes) with a value and a reference to other similar objects. 

To make a reference to other objects, the professor showed us two initialized variable in class LLNode, value and nxt. We were also shown how a wrapper class for a list is made, by initializing variables front, back and size

To walk through a list, we were shown that we had make a reference to at least one node, and move it along the way. I found the code relatively simple to understand, as it just involved initializing the variable as the front of the list, and while there were elements behind, the variable kept referring to the element behind the current one. The general outline of the code for this is as follows:

cur_node = self.front
while <some condition here...>:
       # do something here...
       cur_node = cur_node.nxt

We were also taught a few more methods associated with linked lists, such as implementing __contains__, __getitem__, and delete_back briefly. Overall, this was a relatively easy lecture to understand, but this is just the theory. The practical applications is where I will really need to apply and hone my knowledge in.