In week 11, we learned about Big-Oh. This was a fairly easy concept for me because we spent a fair amount of time on it in CSC165 that I took last semester.
The concept of Big-Oh states that a function is in BigOh(fn) if the function grows no faster than f(n) after a certain point. Or alternatively, f(n) is the upper bound of the function.
Notation wise we can use the following example to illustrate BigOh
O(f) = {g : N → R >0 | ∃c ∈ R + , ∃B ∈ N, ∀n ∈ N, n > B⇒g(n)<= cf(n)
This notation basically explains what I said earlier, which is that then) function g(n) will not grow faster than a constant c times f(n) after the point B.
The fundamental purpose of Big-Oh is to test the running time of a function. If the running time of the function is slower or equal to Big-Oh, we say the function is in Big-Oh, else we say the function is not in Big-Oh.For instance, the function 3x^2 would be in BigOh(x^2) but would not be in BigOh(x).
In this lecture we discussed mainly with linear or quadratic running time. We also touched upon on some ways to solve running time question. For instance, when we solve for while loop running time, we times the running time of the inner loop with the running time of the body loop(of the while loop) to produce a result.
In terms of the application of Big-Oh in reality, I am still very unsure. I suppose it will be used as a way to test the efficiency of a function. For instance, it would likely choose the function that runs with the least amount of running time to increase efficiency.
2015年4月2日星期四
Revisit all previous posts and see if I agree
To do this slog, I had to go back to all my previous slogs and see if my impression has changed or not.
To be honest, I began this course intimidated and scared. I was totally overthrown by the concept of class and sub classes because we didn't touch upon these concepts deeply in CSC108. Therefore, I screwed up really hard on my first test.I made comments on my first few posts to talk about how lost I am in this course. However, when I look back, after completing all the tests and assignments, I began to realize that CSC148 is extremely useful and interesting, and I no longer find it that difficult. This is perhaps the biggest overall change I have made throughout the course.
In week three I commented on my impression of why should geeks write. I still agree with what I wrote. In fact, I now agree more that writing is very important for a computer scientist. It is useful for me to write down my thoughts and come up with ideas, and it is also useful for me to write proper doc string and proper code so my markers can understand.
In week four i made comments about recursion and I said the concept was interesting and challenging. Later in week 5 I made comments on how I am unable to understand the logic behind recursion, as I don't understand how on earth can a function call itself. But as I moved on in the course, and as I did more side research on this subject, I began to realize that the logic or recursion makes sense. I learned that the foundation to build and solve a recursion is to build a base case, and always have the function to go the base case. Once this is comprehended, recursion becomes much more meaningful and I believe I can almost master this concept by now.
I also wrote about Object-oriented Language in week 7. I wrote that slog with a combination of my own idea and some side research. I believe my ideas about Object-oriented Language still holds. This language is basically programming with objects, and making programs by building and interacting different objects.
In terms of my impression of trees and linked list, which I wrote in week 8-9, I believe my impression of trees has drastically changed. When I originally wrote about trees, I thought it is a useless concept that we learn for the sake of learning it. However, as I worked on assignment 3 option A, I realized tree is extremely powerful for programming. This is especially useful when I used tree to solve the MinimaxMemoization class for assignment 3. By think of recursion as nodes and leaves, and drawing the tree structure down on a paper, I was able to clear my mind and provide the solution to the question. My impression of linked-list however remain somewhat the same. I still think the concept is quiet easy but it'as easy to make mistakes when solving a linked-list question. I also haven't studied any practical value of linked-list just yet.
Overall I believe I really enjoyed csc148. It's definitely challenging, but after my hardwork it's becoming much more manageable. Hopefully I do well on the final!
To be honest, I began this course intimidated and scared. I was totally overthrown by the concept of class and sub classes because we didn't touch upon these concepts deeply in CSC108. Therefore, I screwed up really hard on my first test.I made comments on my first few posts to talk about how lost I am in this course. However, when I look back, after completing all the tests and assignments, I began to realize that CSC148 is extremely useful and interesting, and I no longer find it that difficult. This is perhaps the biggest overall change I have made throughout the course.
In week three I commented on my impression of why should geeks write. I still agree with what I wrote. In fact, I now agree more that writing is very important for a computer scientist. It is useful for me to write down my thoughts and come up with ideas, and it is also useful for me to write proper doc string and proper code so my markers can understand.
In week four i made comments about recursion and I said the concept was interesting and challenging. Later in week 5 I made comments on how I am unable to understand the logic behind recursion, as I don't understand how on earth can a function call itself. But as I moved on in the course, and as I did more side research on this subject, I began to realize that the logic or recursion makes sense. I learned that the foundation to build and solve a recursion is to build a base case, and always have the function to go the base case. Once this is comprehended, recursion becomes much more meaningful and I believe I can almost master this concept by now.
I also wrote about Object-oriented Language in week 7. I wrote that slog with a combination of my own idea and some side research. I believe my ideas about Object-oriented Language still holds. This language is basically programming with objects, and making programs by building and interacting different objects.
In terms of my impression of trees and linked list, which I wrote in week 8-9, I believe my impression of trees has drastically changed. When I originally wrote about trees, I thought it is a useless concept that we learn for the sake of learning it. However, as I worked on assignment 3 option A, I realized tree is extremely powerful for programming. This is especially useful when I used tree to solve the MinimaxMemoization class for assignment 3. By think of recursion as nodes and leaves, and drawing the tree structure down on a paper, I was able to clear my mind and provide the solution to the question. My impression of linked-list however remain somewhat the same. I still think the concept is quiet easy but it'as easy to make mistakes when solving a linked-list question. I also haven't studied any practical value of linked-list just yet.
Overall I believe I really enjoyed csc148. It's definitely challenging, but after my hardwork it's becoming much more manageable. Hopefully I do well on the final!
Week 10- Review of week 9
In week 9, we didn't learn much new because we only had a 40 minutes lecture after the test. However, I did have some good experience preparing for the test and I would like to share with the group.
My trick to prepare for the test is to study all tutorial questions and make sure you know how to write them and that they run properly on your computer. I also tried to modify the tutorial questions and solve the modification myself. This was a good practice because the fact that you can solve a modification to the problem shows that you really understands the problem and can deal with whatever way the professor modifies the problem on the test.
The only part that I find difficult was linked list, because it's so easy to make a mistake with it.
Overall I think the test was fairly straightforward. The questions were expected and I think I did very well. The only part that I am not too sure was the linked list part. I am very sure that I have the concept right, but I could have forgotten something there.
The school year is almost over and so far I feel that computer science is so fun. I hope I can keep this up
My trick to prepare for the test is to study all tutorial questions and make sure you know how to write them and that they run properly on your computer. I also tried to modify the tutorial questions and solve the modification myself. This was a good practice because the fact that you can solve a modification to the problem shows that you really understands the problem and can deal with whatever way the professor modifies the problem on the test.
The only part that I find difficult was linked list, because it's so easy to make a mistake with it.
Overall I think the test was fairly straightforward. The questions were expected and I think I did very well. The only part that I am not too sure was the linked list part. I am very sure that I have the concept right, but I could have forgotten something there.
The school year is almost over and so far I feel that computer science is so fun. I hope I can keep this up
2015年3月15日星期日
Week9- Impression of week8
We learned about linked-list this week, and I have a few comments to make about this topic.
Conceptually speaking, I believe linked-list is quiet straight forward. Every list has a value, and a link to point at the list after. Every list also has a front, a back, and a size, as long as the linked list is not None.
However, when we work with linked-list, it becomes extremely hard. This is because there are always too many things to consider. For instance, if I were to add a node before the back of the linked list, I have to remember what is the node before the node that I plan to add, link that with the node that I add, and link the node that I add with the back node. This is just one mere example to demonstrate how easy it is to make a mistake with linked list.It's okay if we write t he linked-list on a computer, as we can always correct a mistake if we make one. But in exam times linked-list will be a killer. Because given the time constrain and the pressure students have during exam time, it may be extremely easy for students to mess up linked list.
After Identifying the difficulty associated with linked list, I began to train myself to cope with this concept. The way I deal with linked-list is always to draw a picture before I solve a Linked-list problem. I also write down the back, the front, and the current node of the Linked-list on a piece of paper, and to track them and see if their position makes sense after my function runs. This method extremely decreases my chance of making a mistake with linked list, and is actually not that consuming which makes it useful under the exam setting.
Conclusion for week 8 is that Linked-list is a fair concept, but students must be very careful with it due to the complexity nature of Linked-list and the easiness to make a mistake while working on it.
Conceptually speaking, I believe linked-list is quiet straight forward. Every list has a value, and a link to point at the list after. Every list also has a front, a back, and a size, as long as the linked list is not None.
However, when we work with linked-list, it becomes extremely hard. This is because there are always too many things to consider. For instance, if I were to add a node before the back of the linked list, I have to remember what is the node before the node that I plan to add, link that with the node that I add, and link the node that I add with the back node. This is just one mere example to demonstrate how easy it is to make a mistake with linked list.It's okay if we write t he linked-list on a computer, as we can always correct a mistake if we make one. But in exam times linked-list will be a killer. Because given the time constrain and the pressure students have during exam time, it may be extremely easy for students to mess up linked list.
After Identifying the difficulty associated with linked list, I began to train myself to cope with this concept. The way I deal with linked-list is always to draw a picture before I solve a Linked-list problem. I also write down the back, the front, and the current node of the Linked-list on a piece of paper, and to track them and see if their position makes sense after my function runs. This method extremely decreases my chance of making a mistake with linked list, and is actually not that consuming which makes it useful under the exam setting.
Conclusion for week 8 is that Linked-list is a fair concept, but students must be very careful with it due to the complexity nature of Linked-list and the easiness to make a mistake while working on it.
2015年3月14日星期六
Week 8- My impression of week 7
In week 7, we studied Binary search trees, which is an Abstract Data Type.
I personally find trees to be quiet easy. It is an application to recursion which uses functions recursively to return the base case and to solve the problem.Since at this point I am quiet seasoned with recursion already, I didn't find trees to be hard.
Binary search trees is just a special kind of tree. Each node of binary tree is only allowed to have two children, and the child to the left of the node must be smaller than the child, while the children to the right must be greater. This feature of binary search tree makes it very convenient for programmers to operate with this. This is because programmers can divide the tree easily into left and right side, based on the the value of the root, and perform operations to both sides. I also assume that this feature allows the program to execute much quickly compared to if we perform operations on the entire tree as a whole.
Furthermore, I also find Binary Search Tree to be much easier than Binary Tree. The fact that it only has two organized children makes it much more predictable than Binary Tree. Hopefully I am right with this impression and binary tree does not become infinitely hard :-).
In addition to binary search tree, we also discussed about Tree traversal this week.I actually find that Tree traversal to be quiet straight forward. Inorder search will always leave the node at the middle, which means the root will always be in the middle of an in-order search. Pre-order search will always have the node in front, then visits the children. And post-order search will always have the node at the end. Using these property, if we are given a list of how the nodes are being reached by each search method, we can easily reconstruct the tree. This is why Tree Traversal is important.
Also, we worked on the assignment this week as a group. I actually think the assignment was a little bit too hard, but my team and I made good progress and finished one required file which is Tippy.move. That was a good achievement!
I personally find trees to be quiet easy. It is an application to recursion which uses functions recursively to return the base case and to solve the problem.Since at this point I am quiet seasoned with recursion already, I didn't find trees to be hard.
Binary search trees is just a special kind of tree. Each node of binary tree is only allowed to have two children, and the child to the left of the node must be smaller than the child, while the children to the right must be greater. This feature of binary search tree makes it very convenient for programmers to operate with this. This is because programmers can divide the tree easily into left and right side, based on the the value of the root, and perform operations to both sides. I also assume that this feature allows the program to execute much quickly compared to if we perform operations on the entire tree as a whole.
Furthermore, I also find Binary Search Tree to be much easier than Binary Tree. The fact that it only has two organized children makes it much more predictable than Binary Tree. Hopefully I am right with this impression and binary tree does not become infinitely hard :-).
In addition to binary search tree, we also discussed about Tree traversal this week.I actually find that Tree traversal to be quiet straight forward. Inorder search will always leave the node at the middle, which means the root will always be in the middle of an in-order search. Pre-order search will always have the node in front, then visits the children. And post-order search will always have the node at the end. Using these property, if we are given a list of how the nodes are being reached by each search method, we can easily reconstruct the tree. This is why Tree Traversal is important.
Also, we worked on the assignment this week as a group. I actually think the assignment was a little bit too hard, but my team and I made good progress and finished one required file which is Tippy.move. That was a good achievement!
2015年3月2日星期一
Week 7- Revisit Recursion
Recursion
Out of the three topics we are assigned
with, I have the most amount of confidence with respect to my understanding of
Recursion, and that is why I will proceed with discussing this topic. The
concept of recursion is a fundamental concept in computer science. It is a
process of defining a function in which the function will be applied to the
function itself. You can think of recursion as pointing two mirrors at each
other, and each mirror will show the reflection of itself. Recursion is useful
many aspects of computer science. So far we have used recursions to break down
lists within lists and produced a result. For instance, we used the recursive
method sum_list to find the sum of all lists within a list. There are of course,
many other applications of recursion, in which we can use to solve complex
problems in computer science.
The power of Recursion extends way beyond
the method sum_list. Recursion is a powerful program technique that can solve
almost all combinatorial problem. One application of recursion we learned in
CSC148 is trees. Trees are recursive objects because they involve a simple base
case and a set of rules that reduce all the other cases towards this simple
base case. The fundamental key of writing a tree is to establish a base case. Once
a base case is established, the rest will likely follow. The base case is
basically a condition in which the recursion ceases to continue, and produces a
result. After we establish a base key, we can then write a recursive function
that will keep on recurring until the condition of the base key is met. The
power of tree to solve complicated nests is just a mere demonstration of the
power of recursion. This concept is perhaps one of the most useful techniques
in programming languages that I will continue to encounter in my future
studies.
Currently I find the level of difficulty
with recursion to be rather fair. I was always able to establish the base case
and often had no problem to write the recursive. However, using recursion to
write minimax method for A2 was especially challenging, which just shows that I
have a lot more to work on with respect to this topic.
2015年2月16日星期一
Week 6 Your summary of Object-Oriented Programming concepts
To be completely honest, I still don't understand too well about Object-Oriented Programming. But I will try my best to demonstrate what it is and its concepts.
I believe Object-Oriented programming is basically programming on objects. Objects represents both data type and the functions to interfere with the data type. For instance, when we design a class, we can design the data type of the class, as well as the set of methods to perform in the class.
It is considered an object because it has both data and a function, thus a complete object. For instance, we can create the object called 'book', which has data type of string, and takes methods such as 'write' or 'read'. After defining, 'book' will have both a type and a method, which allows it to be considered an object in nature.
We can also interact objects with other objects. Perhaps we can link our object 'book' with another object called 'novels'. In this case we can make our object inherit certain methods from the other object, which allows them to interact.
In my opinion, Classes and sub classes are most important elements of OOP. This is because they allow the programmers to actually create the object/module, and combine them to create a functioning program.
I believe Object-Oriented programming is basically programming on objects. Objects represents both data type and the functions to interfere with the data type. For instance, when we design a class, we can design the data type of the class, as well as the set of methods to perform in the class.
It is considered an object because it has both data and a function, thus a complete object. For instance, we can create the object called 'book', which has data type of string, and takes methods such as 'write' or 'read'. After defining, 'book' will have both a type and a method, which allows it to be considered an object in nature.
We can also interact objects with other objects. Perhaps we can link our object 'book' with another object called 'novels'. In this case we can make our object inherit certain methods from the other object, which allows them to interact.
In my opinion, Classes and sub classes are most important elements of OOP. This is because they allow the programmers to actually create the object/module, and combine them to create a functioning program.
2015年2月9日星期一
CSC148 WEEK 5
I actually wrote about recursions last
week, but I suppose I will write it again just to meet up with the topic. The
concept of recursion is very interesting and useful. By allowing functions to
call itself, many sophisticated problems can be solves this way.
The most astonishing fact I find about recursion is that it is able to conduct an infinite number of computations with a finite statement.I also find it astonishing that how recursion is able to solve an apparent logical paradox. The paradox is that whether the method is defined before it is called within himself? Or does it exist after the return function?
For instance the method sum_list(L) is written as follows:
def sum_list(L)
if isinstance(L, list):
return sum([sum_list(x) for x in L])
else:
return L
So is the method sum_list(L) defined in the second line of the code when it is called? If it's not then why wasn't the function producing an error? If it was then what is sum_list before it is even defined?
It is interesting how the computer was able to operate under such paradox, and still produce a result.
The application of recursion is almost everywhere in the world of computer science. For instance, we are about to learn the class tree which will extensively use recursions. I am looking forward to that!
Many of my peers found recursions to be hard. I find it easy. This is perhaps because I have strong mathematical background, and recursion is a concept that is more closely related to logic than programming. The harder part for me is probably the programming part. I am falling behind in programming because I didn't study hard for the first couple weeks, and I better catch up soon!
The most astonishing fact I find about recursion is that it is able to conduct an infinite number of computations with a finite statement.I also find it astonishing that how recursion is able to solve an apparent logical paradox. The paradox is that whether the method is defined before it is called within himself? Or does it exist after the return function?
For instance the method sum_list(L) is written as follows:
def sum_list(L)
if isinstance(L, list):
return sum([sum_list(x) for x in L])
else:
return L
So is the method sum_list(L) defined in the second line of the code when it is called? If it's not then why wasn't the function producing an error? If it was then what is sum_list before it is even defined?
It is interesting how the computer was able to operate under such paradox, and still produce a result.
The application of recursion is almost everywhere in the world of computer science. For instance, we are about to learn the class tree which will extensively use recursions. I am looking forward to that!
Many of my peers found recursions to be hard. I find it easy. This is perhaps because I have strong mathematical background, and recursion is a concept that is more closely related to logic than programming. The harder part for me is probably the programming part. I am falling behind in programming because I didn't study hard for the first couple weeks, and I better catch up soon!
Also, I find the test to be particularly hard. I came from the evening session and everyone said it was hard. Mean while the morning session thought it was easy! This is so unfair!!
2015年1月30日星期五
CSC148 week4
The new material covered this week is recursion,
which I actually find to be very interesting. For the first time I learned that
a function can be used to call itself and solve complicated and annoying
problems. The class example was good in helping me understand this concept
fully. This week’s quiz was much easier than the previous ones, or perhaps I am
better at recursion than I am at class. Anyways I think I got perfect for it. I
feel huge relief after handing in the first assignment. There were many
unclarity with the assignment which caused me to redo it couple times. But at
the end of the day it was good to go and I think I did a good job.
It will be test time next week. So nervous
and unprepared!!!!!!!!!!! Hopefully I do well, if not then I have to make it
the 6% Haha. Anyways I think I will go through the class material and the past paper to prepare for the test. I might also attend one of those helping sessions organized by bluekey education to better prepare.
HOPE I DO WELL FOR THE TEST
2015年1月22日星期四
CSC148WEEK3
- Why should geek write?
The common misconception for computer nerds, or in slang language, geeks, is that they have no capability of communicating through language, and are obsessed with communicating through coding that the so called non-geeks do not understand. This is far from the truth. The truth is that computer scientists do write, and it is necessary for them to write well. This is true because computer scientists also need to communicate with each other using english or other common languages. Codes are often shared or passed on from programers to programmers for different purposes. The ability to write english well will make one’s code much more comprehensive and understandable for other programmers. For instance, if a program writes a function to convert kilometer to miles, the code will be much more comprehensive if it appears as 1mile = 1.6039km instead of 1a=1.6939b. Though both codes will be recognized by the program, it makes much difference when it is interpreted by human, and the lack of clarity in writing can cause significant inconveniences to others.
In addition to that, the ability to write will allow the programmer to write better docstring, and a better description of their program to their future employers. This ability to communicate allows the program to develop better ability to succeed in the professional world, and will be useful in interviews, in real work, and in presentations.
In conclusion, it is important for computer scientists to write because this will allow them to write better code to communicate between programmers, and to increase their communication skills to potential employers in future interviews and practical works.