A whole term has slipped by, that just amaze me of how fast time goes by. Now we are at the end of the term, exam season is coming up! Let us take a look back at how the course turned out for me.
The course CSC148, surprisingly did not cover that much material(I am guessing it is giving some of us a transition break into second year maybe?). Anyways, this term has been amazing. We learned recursion! That is pretty fundamental for a lot of things in coding that comes later on in the conquering of the whole computer science thing according to my research from the internet.
We learned trees, linked nodes, binary search trees...... The list could go on and on, but I think we are actually getting a little bit hang of the whole computer science thing now. I don't think there were a lot of course events?? or am I just being ignorance? We had our weekly lab until the TA's going on strike, but other than that, I don't think much had happened this term.
Overall, this term has been amazing. Big thank you goes out to the TAs(I know you guys' been had some rough weeks.) and our professor Danny Heap. Looking forward to what await us next term.
Friday, April 10, 2015
Revisit of Week 3 Why Geeks Should Write
I still agree with what I think at the beginning of the term. Writing is a way of expressing yourself, and if not yourself, who else is going to tell your story or know what is inside your mind. You need to write in order to communicate with the world. Let the world know what you think, write is a way of communicating with others(like what this blogger said). No normal human beings are going to understand what those code you just wrote are unless you are going to write a description or explanation of it. Just think about the things we buy, wouldn't it be really confusing if they don't come with user manuals? It would probably leave you confusing and don't know what to do with what you just bought, and now who else is going to want to buy that product when they hear a negative review from you?
Writing is really important for everyone. Writing is a part of our lives.
Writing is really important for everyone. Writing is a part of our lives.
Sunday, March 22, 2015
Impression on Week 9
Well, for this week's class, we learned a little bit of assertion, talked a little bit of A3, and function tracing(exciting isn't it)!
Assertion is just checking whether the user has inputed a result which may cause error in the function or not. As helpful as it may sounds, it can cause a little problem on function run times. Because it is checking every input on whether it is a assertion error or not, it has increased the run time of the functions significantly, which may not be a problem for some cases, but a disaster when it really eats away your time.
Another thing we covered this week in class is tracing functions, like the one below. Now, without copy and pasting it to see what the output is, take some time to really think about how it works. What would print(h(1)) output in the python shell(answer at the end of the blog)? It is really interesting right?
N = 5
M = 2
def f(N):
return M * g(N + 1)
def g(N):
return M * N
def h(N):
return f(g(N))
if __name__ == '__main__':
print(h(1))
It is really shocking me how much time to have to spend on your own just to play around in the python shell, and how much stuff you can actually learn from it. Learning by yourself is a big part of this course and hopefully I will see you next week on how the class is going.
Oh and one more thing, the answer is 12, it would carryout the g(1) in the f(g(1)) first which returns 2, and then f(2) which is M * g(3), g(3) would return 6, and M(which is 2) times 6 is 12. Do you get it now?
Impression on Week 8
This week we learned more stuff on Binary Search Trees(AKA BST). It is a tree which can only have up to 2 children. The one on the left is less than the data in that node, and the one on the right is more than the data in that node, and we are going to learn how to carry out delete and insert method on it, including on how to implement the method ourselves.
This is way more challenging than I thought it would be. At first I thought it would just be like any other lab we did before, but without the TA's help, I was a little lost at first, but what is important is I found my way through.
class BTNode:
"""Binary Tree node."""
def __init__(self: 'BTNode', data: object,
left: 'BTNode'=None, right: 'BTNode'=None) -> None:
"""Create BT node with data and children left and right."""
self.data, self.left, self.right = data, left, right
Well, so much for this week. Let's behold what challenge lies head next week waiting for us to solve.
This is way more challenging than I thought it would be. At first I thought it would just be like any other lab we did before, but without the TA's help, I was a little lost at first, but what is important is I found my way through.
class BTNode:
"""Binary Tree node."""
def __init__(self: 'BTNode', data: object,
left: 'BTNode'=None, right: 'BTNode'=None) -> None:
"""Create BT node with data and children left and right."""
self.data, self.left, self.right = data, left, right
class BST:
"""Binary search tree."""
def __init__(self: 'BST', root: BTNode=None) -> None:
"""Create BST with BTNode root."""
self._root = root
The code above is just a to give you a vague idea of what the init method of the code looks like. As you might have noticed, it has two class, we are using the BTNode class to create BST. It is kind of similar to what you might be familiar of, a helper function, but in this case, it is not a function, it is a class(so maybe you can call it helper class??). We are using BTNode to implement BST which is easier to do in a sense of coding. You will know what I mean once you get your hands on it.Well, so much for this week. Let's behold what challenge lies head next week waiting for us to solve.
Sunday, March 8, 2015
Impression of week 7
This week, we learned some linked node that we use in linked list, which is still a type of tree. The following picture is a example of a linked list node. Each of the objects has a value and a reference to other similar objects. It is just like what you can see in the example, at the end of list it simply just refers to none.
The linked list node is not all we learned. We also learned how to use iterations on them, which is just looping, and there are also some mutations, which are updating objects.
I guess it is harder to search for this week's tree, but doable. We did not really use recursion this week, but some looping, old school stuff we learned how to do in 108. I think it is a lot easier than recursion.
I do not know what next week is going to be, maybe some more challenging stuff?? This week's lab is somewhat harder because we do not get to ask the TAs for help, who are strike. Hopefully we will get back to normal tutorials soon.
Monday, March 2, 2015
Recursion
This week on recursion, we went into something called BTNode, a binary tree. Each node can have up to two children and you can actually apply binary method to the data that is contained inside. If the children is bigger than the node, it is going to be at the right of the node, and if not, it is going to the left.
Our job was to create method that evaluate the BTNode, in other words put all the data into application and add, multiply... every data. And also there is a method for representing what is in the tree...etc.
Our job was to create method that evaluate the BTNode, in other words put all the data into application and add, multiply... every data. And also there is a method for representing what is in the tree...etc.
Although there are a lot of similarities in the recursive code we wrote in the previous week, however, this week's code is much more complex. Instead of getting the job done in four or five lines of code, we need to consider more cases this time, therefore, more lines of code.
This week's lab took me a lot more time than the last week, mainly because I thought we only need to write the function in a few lines, but after I realized that we need a lot more lines to finish each function, everything becomes clear again.
I cannot say that this week's recursion is confusing because it is not. Recursion code is made a lot clearer to me than when I first got my hand on it. It is really interesting and I am really looking forward to put it to use in the newest assignment!
Friday, February 20, 2015
Impressions of tracing recursion

def depth(L):
"""
this function returns the depth of the argument if it is a list, else 0
"""
if isinstance(L, list): return 1 + max([depth(x) for x in (L + [’ox’])]) else: # L is a non-list
return 0
return 0
This week we traced some recursion code, the basic idea is to trace from the simplest example like when the argument return list's depth, you start with depth([]), then depth([1]), depth([ 1, 2 [ 3 ] ]), depth ([ 1, 2, 3 [ 4, 5 [ 6, 7 ] , 8] , 9 ]). The point is for you to get the pattern of the code and what it returns, then we trace some complicated argument input, and from the previous examples, you will get the idea of how the code works.
When you see depth([1]) returns 1, you will know that depth([1 , 2 [ 3 ] ]) the [3] returns one then [1, 2] count as another one, so it returns 2, then you know [ 4, 5 [ 6, 7 ] , 8] in the 3rd example would return 2, and it goes on and on. And that is how you trace a reclusive code.
Sunday, February 15, 2015
Summary of Object-Oriented Programming Concepts
I think the concept is really interesting. Even though python does not have any real concept of privacy like java do(Like what this blogger says), the property and default methods are really interesting. And all this other stuff, like raising error when you do not want the user to do anything, or inheriting functions from general class, setting parent class and children class can be a little confusing, but practise makes perfect.
I did not really have a grasp of what OOP means until this course. CSC148 has really opened my mind and view about programming. It is not just about writing functions, it is about constructing structures and making your program faster and better.
This is my summary for OOP concepts so far. Hopefully I will learn more as the course goes.
I did not really have a grasp of what OOP means until this course. CSC148 has really opened my mind and view about programming. It is not just about writing functions, it is about constructing structures and making your program faster and better.
This is my summary for OOP concepts so far. Hopefully I will learn more as the course goes.
Sunday, February 8, 2015
More Recursion, Unit Test and Midterm Madness
Ok, so not much happened this week, as you may know, we had midterms. Unlike most of my friends, my midterms are all before reading week! Not sure if that's a good thing or a bad thing to happen to me. Upside? I have time to do my own stuff and not have to worry about reviewing for test during reading week. And the downside is that I am so busy before reading week. FML...
We had one class this week and the other class we had midterm. Prof Heap lightly touched on unit test in the lecture and some other recursion stuff, and also what is going to happen during midterm. I was late for class because of the heavy snow we got that whole day. (The funny thing is every other school or university or campuses had a snow day, and guess what, my campus did not. I almost got hit by a car while walking on St. George street. Not that this have anything to do with this course, but... I just want to whine about the weather ok?!! ) The midterm was unexpectedly easy by the way for those of you who would like to have a insight on it.
In this week's class, we learned more about recursion. It is really abstract(like what this other blogger said it is some what difficult to understand if you have not heard of the concept before like me. ) I personally think if we could learn more about how to construct recursive function it would be really helpful. Right now, it is still really hard for me to understand what it is, and how to write a function with recursion in it that works out the way I want it to be. Overall, this concept is really interesting and I would love to learn how to use it. We also talked about unit testing this week(? I think we did, but I cannot precisely recall what we discussed about??) Hope we get to learn more about what we are going to do with unit test next week.
Anyways, the course CSC148 has been interesting and challenging so far. Cannot wait to see what is waiting ahead for us.
We had one class this week and the other class we had midterm. Prof Heap lightly touched on unit test in the lecture and some other recursion stuff, and also what is going to happen during midterm. I was late for class because of the heavy snow we got that whole day. (The funny thing is every other school or university or campuses had a snow day, and guess what, my campus did not. I almost got hit by a car while walking on St. George street. Not that this have anything to do with this course, but... I just want to whine about the weather ok?!! ) The midterm was unexpectedly easy by the way for those of you who would like to have a insight on it.
In this week's class, we learned more about recursion. It is really abstract(like what this other blogger said it is some what difficult to understand if you have not heard of the concept before like me. ) I personally think if we could learn more about how to construct recursive function it would be really helpful. Right now, it is still really hard for me to understand what it is, and how to write a function with recursion in it that works out the way I want it to be. Overall, this concept is really interesting and I would love to learn how to use it. We also talked about unit testing this week(? I think we did, but I cannot precisely recall what we discussed about??) Hope we get to learn more about what we are going to do with unit test next week.
Anyways, the course CSC148 has been interesting and challenging so far. Cannot wait to see what is waiting ahead for us.
Friday, January 30, 2015
Recursion
This week in 148, we learn something called recursion. It has a very interesting concept, which is a function within the function itself. I was kind of confused by it when I first saw the concept in class. It was nothing like what we learned in 108, but after some examples we did in 148 I had a really good grasp in what recursion means and does. It would be really interesting to use it in personal projects and other stuff, maybe just play around with it would be fun too.
By this week, everyone in 148 starting to get what the class is doing. For the first three week, everyone was confused by what the professor was teaching in class. Now it's starting to be much clear of what we are learning each week. I have no idea what we are going to be tested in the mid term and starting to feel nervous.
Actually, what I think this class is trying to teach us, is the ability for us to do projects using python on our own. The assignment's description is very abstract in which giving you the space to do all sort of stuff using your imagination.
By this week, everyone in 148 starting to get what the class is doing. For the first three week, everyone was confused by what the professor was teaching in class. Now it's starting to be much clear of what we are learning each week. I have no idea what we are going to be tested in the mid term and starting to feel nervous.
Actually, what I think this class is trying to teach us, is the ability for us to do projects using python on our own. The assignment's description is very abstract in which giving you the space to do all sort of stuff using your imagination.
Thursday, January 22, 2015
Why Geeks Should Write
I think the reason for why geeks should write is that we need to communicate, like the rest of the world. If we do not communicate how will the rest of world know what we are doing. We need a universal way to communicate with everyone else. The stuff we are specialized in are really difficult for some other people to understand, so we write and explain everything and make it simpler by writing it out so everyone can understand it. They would be able to acknowledge our accomplishment, so our accomplishment will actually be useful to the rest of the world.
Recognition is everything, and writing is a good way to let people recognize your work. This is kind of like network building and how socializing is so crucial in the world we are living in today. The world is so big, you are easily ignored if you do not let others notice what you are doing. Writing is a essential skill for us to accomplish what I mentioned above, and that is why geeks should write.
I still agree with what I think at the beginning of the term. Writing is a way of expressing yourself, and if not yourself, who else is going to tell your story or know what is inside your mind. You need to write in order to communicate with the world. Let the world know what you think, write is a way of communicating with others(like what this blogger said). No normal human beings are going to understand what those code you just wrote are unless you are going to write a description or explanation of it. Just think about the things we buy, wouldn't it be really confusing if they don't come with user manuals? It would probably leave you confusing and don't know what to do with what you just bought, and now who else is going to want to buy that product when they hear a negative review from you?
Writing is really important for everyone. Writing is a part of our lives.
Recognition is everything, and writing is a good way to let people recognize your work. This is kind of like network building and how socializing is so crucial in the world we are living in today. The world is so big, you are easily ignored if you do not let others notice what you are doing. Writing is a essential skill for us to accomplish what I mentioned above, and that is why geeks should write.
I still agree with what I think at the beginning of the term. Writing is a way of expressing yourself, and if not yourself, who else is going to tell your story or know what is inside your mind. You need to write in order to communicate with the world. Let the world know what you think, write is a way of communicating with others(like what this blogger said). No normal human beings are going to understand what those code you just wrote are unless you are going to write a description or explanation of it. Just think about the things we buy, wouldn't it be really confusing if they don't come with user manuals? It would probably leave you confusing and don't know what to do with what you just bought, and now who else is going to want to buy that product when they hear a negative review from you?
Writing is really important for everyone. Writing is a part of our lives.
Subscribe to:
Posts (Atom)