Monday, April 6, 2015

Last week slog

  This is last week slog, and We done all works in this course without final exam. I felt interesting in this course and learned a lot of things. Actually, I never try hard to learn any course like that, because I really want to join computer science program. This semester is troubled, because of strike. My quiz's mark is affected. I didn't do very well in the semester beginning, I thought I have chance, we have more quiz in this semester. But I didn't think TA will strike. But my test and assignment are all good. 
  Right now, I will say thank to who helped me in this course.
  Thanks dear prof , Thanks TA(I knew my TA won't that happen), Thanks my team mate.

                                                                                 Yuan Cao


Saturday, April 4, 2015

Week 11

The topic of this week requires us to revisit the topics previously discussed and see if our opinion has changed. The three topics that I discussed previously are recursion, trees and linked-lists.
I stated in my earlier posts that recursion is a difficult and very difficult to comprehend. Now when I revisit this topic, I still find the logic beneath recursion to be difficult, but I find recursion problems to be much more solvable.  This is my practices of recursion has allowed me to find a rather systematic way to solve recursion questions. The secret is to always establish a basic case and recur back to the case to solve the question.  Although I can solve recursion questions, I still find the logic behind recursion to be highly difficult to understand. Perhaps I will need to do more work on this topic.

In terms of Trees, I wrote in my earlier posts that I believe it is a rather clever and intellectual way to demonstrate data, but I didn’t think it was useful. Now that I look back, I think tresses are extremely useful. It is a recursive data structure that helps us to perform many operations. For instance, in Assignment 3, we modified the Minimax function using tree attributes and was able to significantly modify the running speed of Minimax by memorizing the children of trees and call the child once another tree share the same child.
In terms of linked list, I believe my previous impression of linked list has not changed. I still feel that linked list is a simple concept in terms of the current depth we touch upon. However, I also acknowledge that it is extremely easy to make a mistake W.R.T linked list questions due to its complexity.
As this course approaches its end, I feel that I have overall gained good academic development and much better understanding of CS. I hope I can keep this up and become a better computer scientist in the future.

Thursday, April 2, 2015

Week 10 slog

At the beginning of last week, I spent a lot of time to review my second term test.  I missed the first one because of sick. I was worried about recursion function. Sometime, I can write true function, it work, but I don't know why it worked.Right now ,We have done second term test last test. It's include Recursion,Tree, Binary Tree, and link list. Hopefully, I will get good mark on that test. Good luck for me.

Saturday, March 21, 2015

Week 9

This week we studied about linked list. It is a fun topic that is not too hard but definitely not too easy.

Conceptually speaking, linked list is not hard. Every node has a value and a link to the lists ahead of it. The first list is called the front and the last list is called the back. Many operations can be performed with linked list. The most common one is to either add a node to the front or to the back of the list. While adding a node to the front is easy, adding it to the back is relatively more complicated. This is because when we add a node to the back, we not only have to link our back with the new node, but we also have to link the node before our previous back with our previous back. This creates some complexity, and often a while loop is used to solve the problem.

The thing I find with linked list is that the concept is fairly easy, and yet it is extremely prone to mistakes. You can miss the question by simply forgetting to link two nodes together. This nature of linked list should alert us when we solve a linked list question. We must be super careful with our logic and never forget what links with what.

Week 8

This week we studied binary trees. This topic is rather interesting because the outcome of the tree is very predictable, which makes it easier to computer compared to regular tree. Each binary tree will have two children, and the child to the left will always have the value less than the value of the node, and the child to the right will always have value greater than the node. This feature of binary tree allows us to perform operations on the tree with much ease. For instance, I can easily search for a value in the tree by comparing the value with the value of the node. If it’s less than the node and it exists, I will know that it must be contained in the left tree, else it must be in the right. Using this feature, I can easily find my intended value. In addition to the easiness of performing operation on trees, operations can also be performed with high efficiency. This is because instead of working with the whole tree, the nature of binary tree often allows us to only operate with half a tree. This is significant amount of time saved, and will likely allow the program to run more smoothly and quickly.

We also studied about tree traversal this week. To be honest I do not necessarily get what is the point behind the different way of visiting a tree. My opinion is that it’s most efficient if we just stick with one method. Well I am just a noob in the industry so what can I say haha J

To conclude, this week’s work has been rather fun and interesting. I am however a little bit upset that our TAs went on strike and we no longer have tutorials. This is bad for me as I always learn a lot from the tutorials.

Monday, March 2, 2015

Recursion



Recursion is a useful tool that we learned in CSC148 which was helpful for us to solve many complex and combinatorial problem. For instance, using a simple recursive method sum_list, we were able to solve the rather complicated problems of lists within lists.

In CSC148,we were also taught about trees, which is just an application of recursion. Trees are potentially recursive because when we solve a problem related to trees, we always try to reduce it to the root, which is potentially the base case. The tree is a perfect demonstration of the fundamental feature of recursive function .In my opinion, recursive functions have two attributes. A base case in which the recursion stops and a line of code that will operate recursively and eventually reduce the input into meeting the condition of the base case.

The most difficult part with writing recursive function actually lies on identifying the base case. This can be hard sometimes as the base case may not be that obvious. However, once we have the base case established, all we have to do is to write a recursive function that returns the input into fulfilling the condition of the base case, and we are done.

Friday, February 20, 2015

Object Oriented Programming

Why is Object-Oriented Programming Useful? 

This blog post is those new to programming and have probably heard about "object-oriented programming", "OOP", "classes", "inheritance/encapsulation/polymorphism", and other computer science terms but still don't get what exactly OOP is used for. In this post I'll explain why OOP is used and how it makes coding easier. This post uses Python 3 code, but the concepts apply to any programming language.
There are two key non-OOP concepts to understand right off the bat:
  1. Duplicate code is a Bad Thing.
  2. Code will always be changed.
Aside from small "throw-away" programs that are written for some single task and only run once, you'll almost always need to update your code to either fix bugs or add new features. A large part of writing good software is writing software that is readable and easy to change.
If you have copy/pasted code in your program, changing it requires making the same change to multiple places in your program. This is problematic. If you miss applying the change to some places, you'll fail to fix the bug everywhere or implement the new feature inconsistently. Duplicate code is a Bad Thing. Having duplicate code in your program is setting yourself up for bugs and headache.
Functions let you get rid of duplicate code. You write the code in a function once, and just call the function everywhere your program needs that code run. Updating the function's code updates it everywhere the function is called automatically. Just as functions makes updating code easier, using object-oriented programming techniques also organizes your code to make changes easier.And code will always be changed.
Summary
I hate programming tutorials for beginners that start with object-oriented programming. OOP is a very abstract concept. Until have some experience and are writing large programs, example like Assignment 1. After A1 ,I have no problem with OOP. I am enjoy it now.