Friday, 3 April 2015

Week 12 SLOG

This week during class we learned about how to construct functions that can execute in a specific amount of time, as well as assertions. In order to make sure that our minimax function was able to do all of the required things, it is necessary to set up a few unittests to make sure that the expected result is returned.
Next we learned about deepcopy. We were given a few example of lists within lists which we had to copy and try to change just the copy in various ways. As it turned out, simply copying one layer of the list of lists would result in the original list to be changed as well. In order to solve this problem, we had to make a copy of the list and itterate over every sublist within the lists seperately in order for the original list to remain unchanged.

Wednesday, 25 March 2015

Revisit of Week 4 SLOG

While writing my week 4 SLOG (topic: impression of the first few weeks of the course), I discussed the topics of writing classes, and writing the important methods that are needed for classes, and subclasses. While I was learning this for the first time, and trying to understant what "self" actually meant (becasue at the time it seemed so anstract), I found it a bit difficult to understand. However, since the beginning of the year I was required to write so many classes for different topic including: recursion, trees, BST's and so on, that now implementing all of these methods seem secornd nature to me. I find that I no longer need to over think the implemetation of methods and focus on implementing the functions in the class to perform the desired action.

While working on my first assignement, I mentioned in my week 4 SLOG that I had originally had difficulty understanding how the game was supposed to run, and what exactly I was supposed to do. But after I got over the initial problems in assignement 1, I found I was able to complete assignment 2 quicker, which was a sequal to assignement 1 in which we were taking our game a step forward and designing a strategy for the coputer to use while playing. This strategy was however, painstakingly slow so in assignemnt 3 we will focus on coming up with a strategy to make the strategy run quicker!

Friday, 13 March 2015

Week 9 SLOG

During this past week we learned how to mutate binary search trees by inserting or deleting nodes. We began by looking at different scenarios, and deciding how we would delete a specific node so that the BST chracteristics still remained. First, we worked with deteting the root of the BST when the tree had only either a left child or a right child, but not both. In this case, the root of the subtree would become the new node. The diffuculty arose when we tried to delete a node that was the root of both a left child and a right child. In order to figure out this problem, we tried to find another node in the existing tree that would still satisfy the properties of the BST if the said node were to replace the deleted node. By doing this, we learned that either the maximum of the left nodes or the minimum of the right nodes would work in this situation. Overall, I didn't feel that comfortable with the material from this  week's class because we only had one lecture due to the midterm this week. Working on the lab however, might fix this problem.

In terms of the midterm this week, I felt pretty nervous about working with linked lists, so I spent most of my time reviewing the code for linked lists that my instructor posted on the website. Overall, I think that the test was pretty fair.

Sunday, 8 March 2015

Week 8 Slog

This week we learned all about linked lists which are a linear sequance of nodes which keep track of which section is the front and which section is the back. This whole topic was completely new to me. I think linked lists are very interesting and useful because they are able to keep track of sublists of informtion which are related to each other. We also learned how to traverse across linked lists which is useful for mutating. Mutating across linked lists will give us the necessary practice needed to be able to mutate trees in the future which are much more difficult to mutate. Finally, we learned that since mutations allow for much more errors, it is essential to draw diagrams of linked lists and how a mutation will affect a linked list.
Some problems that I had this week had to do with lab 7 and implementing the various functions. Previously in class, we had only talked about what exactly a linked list was, and what it represented, as well as seeing the __init__ method. However, we had not yet worked with linked lists so I was not sure how to ewrite methods for them, and I was also quite confused as to what the various functions in the lab were supposed to do. In order to combat this problem, I reread the lecture notes seral times, and sought out extra materials about linked lists and how to implement their functions. I then compared my functions with the sample solutions that were posted a few days later, and made the required corrections for my notes.

Thursday, 26 February 2015

Abstract Data Types

Abstract Data Types are structures that can be useful across many problems. There are a few different examples of ADT's that we have learned about in class including Stacks / Queues, Trees, Binary Trees. Their main use is the storage of information.

Stacks:
A stack is an ADT that contains many different tupes of items. When adding new items to a stack, the new item is stacked, or pushed on top of the items already in the stack. On the contrary, to remove and item, the item is removed from the top, meaning that the last item added to the stack is the first one to be removed. "pop" is used to remove the item from the stack. Some important uses for the stack ADT are to track the function calls as a program is being run, and checking for balanced parentheses.

Queue:
Queue is closely related to stack ADT's meaning that is also deals with the storage of data, however the difference is in the order that new items are added and removed. A Queue is a "First in first out" data structure, meaning that the first item that was added to the queue will be the first one removed.

Trees:
A tree is a set of nodes(a node can have any value) with edges between these nodes. Nodes are divided into two categories, which are parent nodes and child nodes, each child node has a parent, except for the root, which is the beginning of the tree. Parent nodes that do not have any children are called leaves. Recursion is especially useful when dealing with trees because the root is able to deleagete various tasks such as finding height, depth, and others to its children, and from there it gets passed on to the children's children and so on until a leaf is reached, at which time the information gets passed back in the opposite direction to the parents until the root recieves all the information. Tree ADT's are mainly used to represent hierarchical relationships.

Binary Trees:
A binary tree is a subset of the normal tree in that each node can only have a maximum of two children. 

Friday, 13 February 2015

Week 6 SLOG

For the past two weeks we have been learning about Abstract Data Types, specifiaclly stacks and trees. Before doing the lab, we had only briefly touched upon stacks in class, therefore I had to reread the lecture notes a couple of times before I knew how to complete the lab questions. Next, for this week's lab was the topic: Trees. In the lecture, in order to fully understand trees, we created our own real life tree in which one student at the back of the class was the root with two children, and each of those children had their own two children, and so on until every student in the class was part of the tree. We then began to figure out the height of the tree, and other aspects based on our real life tree. I found this really helped my understanding of how trees actually looked, and how they delegated specific tasks to their children. At first, I was kind of confused as to how to complete the function bodies for the various functions in the lab, but after looking up some examples I got the hang of it, and I realized that trees are quite simply another form of recursion. Knowing this greatly helped me to proceed and complete the rest of the function bodies.

Wednesday, 4 February 2015

Week 5 SLOG

My impressions of tracing recursion:

To begin off our lecture on recursion, the istructor provided us with a problem involving a list within a list within a list... At first this preblem seemed completely bizarre and I had no idea where to even begin. We then began working on a problem in class, which essentially returned the the greaters number in the list. We first began by feeding the function something that was not a list (int) and observed what the function gave back, then moving to lists of depth 1, all the way to lists of depth 3. I found, as we went along, that while increasing the dephth of the list, we didn't really need to think about how to calculate anything new, but rather we just have to use exactly what we implemented before that. So in other words, recursion was just basically applying the same base computation multiple times in order to solve a more complex arrangement. Being a math major, I find that recursion in kind of like a puzzle in which you are always trying to see where to place elements of a list, and when a function needs to call itself. I really enjoyed learned about recursion (my favourite topic of the course so far), and I think it is very useful in that it make problems that originally seem very complicted, more simple by breaking them down into smaller steps.

Tuesday, 27 January 2015

Week 4 SLOG

My impression of the first few weeks:

To begin the course, we began learning about how to construct classes, and the different methods which were found inside classes such as __init__, __str__, __repr__, just to name a few. The basic setup of the class and the __init__ function was similar to CSC108, so I somewhat already had an idea of where the course was headed.  Learning all about __str__ and __repr__ methods and how to set them up and what they were used for was new maternial for me. Since we had only quickly went over this material at the end of CSC108 I had only the knowledge of where to place different methods and elements of a method (such as self), but I had no idea what these things actually meant or how to apply them to a problem that deviated from the class example. This was alright for CSC108 since we simply dealt with quite easy problems. What I found very helpful during the lecture was that right away the instructor explained what self, init, repr, str, and eq meant and what exacly they were used for, and this helped me because it allowed me to apply these methods to all the examples and the labs, as well as the assignment. After this, we leaned about subclasses which was a completely new topic for me, however since it was essentially the same as the classes I already knew about I found subclasses easy to understand.

My impressions of A1:

When I first read the assignment handout I was quite confused and I had no idea what to do and where to start, in CSC108 all of the assignments were laid out step by step and there was absolutely no ambiguity. It took me a few reads before I was able to jot down some notes on what was expected, and this was complemented by checking piazza and I saw that many of the questions that I had were all already answered. I found this assignment to be quite challenging because I am not very familiar with how different types of games work or any strategies that are involved, or how one plays variois computer games. So trying to learn about how games work was very time consuming for me.


Tuesday, 20 January 2015

Why Geeks Should Write

I'm sure everyone has been in a situation where they hear someone say something like "oh I'm not good at writing because I'm more of a science person", or "I don't know what to write about because I'm in computer science", well in my case its more like "I don't particularilly enjoy writing, I'm a math major, so I enjoy solving different kinds of problems alot more!" Nevertheless, it is crucial that all nerds (no matter what major) should know how to write well, or at least get some practice from time to time. Imagine if Copernicus, or Einstein, or Hawking didn't write, well we wouldn't know the fundamentals of science which we take for granted today! I believe that geeks need to write because writing is the most basic staple of expressing ones ideas, beliefs, observations, and discoveries. It's a great thing to be well rounded! Especially in the computer science world, we are constantly needing to write out codes, comments, and ask others for help on piazza. In short, if nerds didn't write, well, the world wouldn't know they were nerds, and its quite liklely that they wouldn't be as wanted by employers in the ever competitive job market.