CSC148H1S Fandi Xu
2015年4月3日星期五
week 12: Last impression
Finally the 148 class is over. When I look back what all of the lecture says, I find the different feeling. At the first, I just learn about some class such as BTNode, Linklist, And the methods of recursion. But then, I find they have many of relationships. We don't just learn these classes but we learn how to create the class like those. In my opinion, the CSC148 teach us not only the knowledge of computer science but also the more important part that the idea and thought of solve the practical problems.
2015年4月1日星期三
week11: Agree about my earlier slog
I have revisited the some earlier slog in my blogger. I think that most of them are very right and I have deeper feeling about the important of writing debug travel and learn more about the some class and methods written in earlier blogs.
For example, writing the debug travels help me and my teammates a lot in assignment. Because of the teamwork, some thoughts or progresses we don't know each other clearly. We can't find some bugs quickly. And it is also a long codes, we may not find the bugs in all codes in one day or once. we can't remember the train of thought before or don't know other teammates' directly. The debug travel helps us a lot.
For instance, the method of recursion is usual thought in python codes. At first, I just know how to write the recursion in the specific class like BTNode. In other code, I may not think out this method. However, the recursion is the thought to solve the problem. In assignment, we have more chance to practice it. I can create myself class and apply it to solve my given function. It can save my time to figure out the code if there are too many repetitive steps. Recursion is not only the method to write code, but also the thought to solve the problems.
For example, writing the debug travels help me and my teammates a lot in assignment. Because of the teamwork, some thoughts or progresses we don't know each other clearly. We can't find some bugs quickly. And it is also a long codes, we may not find the bugs in all codes in one day or once. we can't remember the train of thought before or don't know other teammates' directly. The debug travel helps us a lot.
For instance, the method of recursion is usual thought in python codes. At first, I just know how to write the recursion in the specific class like BTNode. In other code, I may not think out this method. However, the recursion is the thought to solve the problem. In assignment, we have more chance to practice it. I can create myself class and apply it to solve my given function. It can save my time to figure out the code if there are too many repetitive steps. Recursion is not only the method to write code, but also the thought to solve the problems.
2015年3月24日星期二
week10: The reflection of minimax strategy
After we finishing the assignment 2, we will consider the reflection about the assignment 2. The core of the assignment 2 is the strategy of minimax. it is the new idea about the perfect strategy of computer. Unlike that the simple strategy depending the first square subtract game, the minimax strategy is the independent algorithm. It can apply to any games. It is calculate the every situation of the sum of winning probability for next step until the final step. And then, it chooses the best way to win the game of computer.
During the assignment 2, we learn about the application and complete the code of minimax strategy. After that, we should test the whether it is work and where we should improve. We should consider which data we can use to test the strategy is worked. For example,in the square subtract game, if we test the current number 10 all the next step is loss, and if we test the current number 11 all the next step is win. As the result, we can't get the information about whether the code of minimax strategy is worked.
In addition, we should think about the shortage about the minimax strategy. For every step, we must consider the all step until the final situation of winning, which is too wasting time. And we should think about how simplify the strategy. It is our job in assignment 3.
During the assignment 2, we learn about the application and complete the code of minimax strategy. After that, we should test the whether it is work and where we should improve. We should consider which data we can use to test the strategy is worked. For example,in the square subtract game, if we test the current number 10 all the next step is loss, and if we test the current number 11 all the next step is win. As the result, we can't get the information about whether the code of minimax strategy is worked.
In addition, we should think about the shortage about the minimax strategy. For every step, we must consider the all step until the final situation of winning, which is too wasting time. And we should think about how simplify the strategy. It is our job in assignment 3.
2015年3月15日星期日
week9: impression of BST
In this week, the future class of BTNode is BST. The relationship between BTNode and BST is same as the LLNode and LinkedList. BST is built form many BTNode, but BST in not a list of BTNode instead of tuple type. In the other words, BST is an totally new class contains many BTNode in the class.
Many functions under the class also apply the thinking methods of BTNode class. For example, the insert and delete function also use the recursion methods. I also respectively compare whether objects that insert or delete are greater or smaller than self.data and then compare information in the left and right children. In addition, BST has another statement, self.root. As a result, when I insert or delete the value in BST, I need to add or minus one size in self.root and the other step is similar with BTNode.
Many functions under the class also apply the thinking methods of BTNode class. For example, the insert and delete function also use the recursion methods. I also respectively compare whether objects that insert or delete are greater or smaller than self.data and then compare information in the left and right children. In addition, BST has another statement, self.root. As a result, when I insert or delete the value in BST, I need to add or minus one size in self.root and the other step is similar with BTNode.
2015年3月9日星期一
week8: impression of LinkedlistNode
This week, I have learnt a new class named LinkedlistNode, which is a little different from other class. It has more visual picture in their printing. However, they also have some similar elements between LinkedlistNode and Tree or BTnode. the node.nxt in LinkedNode has the similar meaning like the children in Tree or Btnode. In the other hand, it has different method of calculation in function. For example, there are many recursion using in Tree and Btnode, because there can consider their children or left and right leaves to finish all situations in the class.
In the LinkedlistNode class, we use another method - while loop as the main idea in the function. For example, in the __add__function, we us while loop and cur_node = cur_node.nxt to circulate the whole LinkedlistNode. This is an other method of circulation.
In the LinkedlistNode class, we use another method - while loop as the main idea in the function. For example, in the __add__function, we us while loop and cur_node = cur_node.nxt to circulate the whole LinkedlistNode. This is an other method of circulation.
2015年3月2日星期一
week7: Recursion
In the Week 7, we have learnt about the BTNode, which is similar with class Tree. BTNode also have root and leaves. However, there is only two children with right and left instead of the many children.
In many definition under the class BTNode, they need to apply to recursion in their code. We should consider the recursion of right and left children. For example, def list_longest_path(node) in class BTNode in lab06. We find the list_longest_path(node.left) and find the list_longest_path(node.right). Then, we compare the longer one between left and right children. Eventually, we can return the longest one in all these nodes. This is the traditional recursion.
2015年2月12日星期四
week6
Firstly, I learnt some types
of sorting algorithm this week through Internet, such as merge sort & quick
sort & bubble sort & heap sort etc. Then I got an acknowledge of unit
tests, PyUnit specificlly. I think it's very useful as you can prepare for a
set of cases, then use them over and over to see where's the bug in your codes.
I think I will save a lot of time for using unit tests later, and it will also
let me grouping my test cases for different use such as boundary cases/ invalid
inputs / huge data & long computing time cases etc. Besides, I also learnt
that parentheses, brackets, braces matching is stored at stack
and done by compiler. From this lecture, the importance
of parentheses matching also been emphasized, and I'll keep in
mind checking every parentheses before run the codes.
订阅:
博文 (Atom)