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.
2015年3月15日星期日
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.