It hit me today that first year is officially over. This week is the last week of second semester which means this will be my final entry. This course has been quite a ride. In the beginning of the year I totally underestimated the course because of how easy CSC108H1 was. Now I actually take it much more seriously. Overall I thought the course was a healthy challenge.
This week we learned about how to trace your code. It is quite simple, yet very effective when checking to see whether code works or not.
Friday, 8 April 2016
Wednesday, 30 March 2016
CSC148 Week 11
So I was looking back to my week 4 entry, and I noticed that some of my opinions have developed a bit. I said that I had to change my study habits in order to do decent in this course. I was correct about this, but in order to do great in this course, it takes a
lot of dedication, practice, and question asking to get a great mark. Since then, changing
my study habits has lead me to do much better on the second test than on
the first test.
I've also stated that I found unittesting to be "complicated and confusing". I still agree with myself on this. I prefer just putting tests in my docstring (you'd use doctest to test them) since they're usually short anyway. It's easier and saves a lot of time. On the other hand, unittest is great for when you need to do a really long test for a method. Putting such a test in the method's docstring would just look silly because of its length.
I've also stated that I found unittesting to be "complicated and confusing". I still agree with myself on this. I prefer just putting tests in my docstring (you'd use doctest to test them) since they're usually short anyway. It's easier and saves a lot of time. On the other hand, unittest is great for when you need to do a really long test for a method. Putting such a test in the method's docstring would just look silly because of its length.
Friday, 25 March 2016
CSC148 Week 10
This week was pretty eventful, we were able to see our test 2 marks on cdf and we had an assignment due on Thursday. I did significantly better on test 2 than on test 1, so I feel happy about that.
This week in lecture time we learned about Algorithm efficiency. What specifically caught my eye was memoization. Memoization is a technique that is used to speed up program efficiency by eliminating redundant function calls. This technique still allows the function to produce its expected output each time. For example, Let's say you have a recursive function called f(int_num) that constantly produced the call f(30). Let's also say that f(30) always evaluated to the same integer every time it was solved by the function. So then, why bother letting the program waste time to evaluate f(30) when you can just store the value of f(30) (in a dictionary for example) and replace any f(30) calls seen in the future with its value? This technique would save a lot of processing power.
Friday, 18 March 2016
CSC148 Week 9
This week we had our second term test on Wednesday (March 16). It covered LinkedList, LinkedListNode, Trees, Binary Trees, and Binary Search Trees and recursion. I thought the test was pretty fair, we had more than enough time to finish it and all the questions were answerable.
During lecture time, we learned about Binary Search Trees this week. A Binary Search Tree is a Binary Tree where each node has up to two children, a right child and a left child. A node's left child is less than the node's data and a node's right child is greater than a node's data. A Binary Search Tree can be used to find a certain value more efficiently than if you were to find the value in a Binary Tree or Tree. For example, if the value you want to find is less than the root's data, this means that the node you want to look for is to the left of the root. So you'll want to look at node's left child, and then their children, and so on, until you find the value you're looking for. If you had to look for a value in a Binary Tree or in a Tree, you'd have to check the value of every node within its structure. We also learned about inserting a node into a Binary Search Tree and deleting a node from a Binary Search Tree.
During lecture time, we learned about Binary Search Trees this week. A Binary Search Tree is a Binary Tree where each node has up to two children, a right child and a left child. A node's left child is less than the node's data and a node's right child is greater than a node's data. A Binary Search Tree can be used to find a certain value more efficiently than if you were to find the value in a Binary Tree or Tree. For example, if the value you want to find is less than the root's data, this means that the node you want to look for is to the left of the root. So you'll want to look at node's left child, and then their children, and so on, until you find the value you're looking for. If you had to look for a value in a Binary Tree or in a Tree, you'd have to check the value of every node within its structure. We also learned about inserting a node into a Binary Search Tree and deleting a node from a Binary Search Tree.
Friday, 11 March 2016
CSC148 Week 8
So this week I learned a bit about BinaryTrees. BinaryTrees are Trees in which all of their the nodes have 2 children. We also learned about Binary Search Trees, which is basically a BinaryTree where at generally any node, (let's assume the node we pick has two children and that the node has a float or int value) the node's left child is less than the node in value and the node's right child is greater than the node in value.
In this weeks lab we had to work on functions that worked with Trees. I took a whole evening to struggle with the material. I found the lab to be a bit challenging, especially the list_internal function. By the following morning, I felt the material start to sink in!
In this weeks lab we had to work on functions that worked with Trees. I took a whole evening to struggle with the material. I found the lab to be a bit challenging, especially the list_internal function. By the following morning, I felt the material start to sink in!
Wednesday, 2 March 2016
CSC148 Week 7
For the majority of this course, we've been introduced to many different kinds of commonly used abstract data types such as queue, stack, sack... and so on. An abstract data type is a data type that can be created by a user. This data type has its own behavior, has its own data, and has its own operations that manipulates/interacts with their own data. During this week we learned about a new abstract data type called Trees.
You can imagine a Tree as a data structure with a chain of nodes that can be imagined as a hierarchy. A Tree's nodes store one value each. (i.e. 7) Some nodes lead/refer to other nodes, and some nodes don't refer to any other nodes. Nodes that don't refer to other nodes are called leaves, since they are "childless". All trees have a starting node called a root. Every node in a tree is a descendant of the root. The root itself is the only node in a Tree that doesn't have a parent. Here's an example of a tree with each node being represented using parentheses: (1) has three children, which are (2), (3), and (4). (2) has a child which is (10). All other nodes are childless.
We learned that Tree has very basic operations such as __str__, __contains__, __repr__, and __eq__. During this week we've also learned about some (module level) functions that can be used to manipulate Trees or get information from Trees. These module level functions strongly relate to recursion.
You can imagine a Tree as a data structure with a chain of nodes that can be imagined as a hierarchy. A Tree's nodes store one value each. (i.e. 7) Some nodes lead/refer to other nodes, and some nodes don't refer to any other nodes. Nodes that don't refer to other nodes are called leaves, since they are "childless". All trees have a starting node called a root. Every node in a tree is a descendant of the root. The root itself is the only node in a Tree that doesn't have a parent. Here's an example of a tree with each node being represented using parentheses: (1) has three children, which are (2), (3), and (4). (2) has a child which is (10). All other nodes are childless.
We learned that Tree has very basic operations such as __str__, __contains__, __repr__, and __eq__. During this week we've also learned about some (module level) functions that can be used to manipulate Trees or get information from Trees. These module level functions strongly relate to recursion.
Friday, 26 February 2016
CSC148 Week 6
Reading week is over! I honestly wish it was longer, but at least I was able to catch up on sleep.
We started talking about recursion this week. Recursion is a technique in which a method is used within itself. The method is executed many times times (within itself) in order to keep changing certain data. Recursion can be used to make beautiful visuals such as fractals. To have a method work within a method is pretty mind blowing!
We also learned about the one liner version of an if else statement. Here's an example below:
>>> z = 100
>>> z = 10 if z == 100 else print('banana')
>>> z
10
I found the syntax of the one liner version to be confusing at first. It took me a lot of typing in python shell to figure it out/understand it. The above statement literally means: I want z to equal 10 if the expression z == 100 is true, or else print the string 'banana'.
We started talking about recursion this week. Recursion is a technique in which a method is used within itself. The method is executed many times times (within itself) in order to keep changing certain data. Recursion can be used to make beautiful visuals such as fractals. To have a method work within a method is pretty mind blowing!
We also learned about the one liner version of an if else statement. Here's an example below:
>>> z = 100
>>> z = 10 if z == 100 else print('banana')
>>> z
10
I found the syntax of the one liner version to be confusing at first. It took me a lot of typing in python shell to figure it out/understand it. The above statement literally means: I want z to equal 10 if the expression z == 100 is true, or else print the string 'banana'.
Wednesday, 10 February 2016
CSC148 Week 5
I tried the sample test questions that our professor gave us last week and question #3 caught me off guard. So I decided that I should review superclasses and subclasses again during the weekend. Good thing I did too, since one of the three questions on our first test involved superclasses and subclasses again.
In fact, the first test was just earlier today! I thought the it was pretty fair, it covered a fair region of what we learned in the past 5 weeks, but I would have loved to have an extra 10 more minutes to finish it confidently. I felt like the classes I had to create on the test were poorly designed since I was under such a short time limit. At least the test didn't have any questions based on LinkedLists. That would have made the test way worse.
Anyway, reading week starts this week, I'm pretty sure almost every university student has been looking forward to this week for a long time. Happy reading week!
In fact, the first test was just earlier today! I thought the it was pretty fair, it covered a fair region of what we learned in the past 5 weeks, but I would have loved to have an extra 10 more minutes to finish it confidently. I felt like the classes I had to create on the test were poorly designed since I was under such a short time limit. At least the test didn't have any questions based on LinkedLists. That would have made the test way worse.
Anyway, reading week starts this week, I'm pretty sure almost every university student has been looking forward to this week for a long time. Happy reading week!
Saturday, 6 February 2016
CSC148 Week 4
I realized that this course is way more fast paced than CSC108 and that I have to change my study habits if I want to do really well in this course. I didn't do as good as I wanted on Week 2's quiz... thankfully the lowest quiz is dropped!
During this week I learned about the stack class, which is like a list. When you add an item to a stack, it is added to the end of a it, When you remove an item from a stack, the item at the end it taken out. It's a really simple class. It includes __init__, __eq__, __str__, remove and add methods.
During the lab, we focused on stacks. We had to create a queue class. A queue is slightly different from a stack, when it has to remove an item it instead removes it from the beginning of the queue. We also had to create unittests for both the stack and queue class. I find unittest complicated and confusing for me, so I'm going to review the topic this weekend.
During the lab, we focused on stacks. We had to create a queue class. A queue is slightly different from a stack, when it has to remove an item it instead removes it from the beginning of the queue. We also had to create unittests for both the stack and queue class. I find unittest complicated and confusing for me, so I'm going to review the topic this weekend.
Wednesday, 27 January 2016
CSC148 Week 3
I've actually never created a blog before. This is my very first entry, so... here goes nothing!
I feel like I've been doing pretty decent with the CSC148 material so far. I understand subclasses, stacks, special methods (__init__, __str__, and so on), and how to raise exceptions.
One of the things I learned this week that I found interesting was how you can use a for loop in one line. Here's an example:
>>> L = [0, 2, 4, 6]
>>> # Every item (x) in list L has a 1 added to it. The resulting list is then assigned to L.
>>> L = [x+1 for x in L]
>>> L
[1, 3, 5, 7]
I thought that way pretty cool. It'll definitely save me quite a few lines of code while writing Assignment 1.
Subscribe to:
Posts (Atom)