This week's mission is to look back one of my earlier work, so I chose to revisit my week 6's slog.
I found the topic was about how to write recursion and the result of the test 1.
As for the first part, I agreed with most of what I said. But I also think it was too narrow and not complete enough. During those weeks, I found the most important thing was to understand the recursive part, which means, what was called again and again. If I can not understand what part I repeat over and over again, the function would definitely be in a mess. So drawing a picture is vital as it will help me to understand the process of the function, which is most important.
Understanding the algorithm before writing the function. That is what I learned from writing recursion function, which, in my opinion, is also of great importance for writing other complex functions as well.
And as for the test 1, in week 6, I still think what I've written is OK. However, during this week, I found that if I don't use a systematic way to write functions, even though it works for the problem itself, it can make me impossible to go further. By working on those assignments, I really understand why our instructor urge us to so like him. The systematic way he told to us can really avoid us from getting into mess. Also, I found I mistakenly understood how I should learn this course in the week 6's slog. During this week, I found myself not hard-working enough, I seldom worked on the extra exercise. That made me not so familiar with what we had learned. And in this case, even I knew how to deal with the problems on test 2, as I was not so familiar and under stress from the test, I did really bad at the test 2. That really made me sad. In the coming weeks, I think I will practice more to get what I want in the final.
I've looked for my classmate chirstiangarcia's slog as well. (http://christiangarciacsc148.blogspot.ca/)
This slog was really an excellent job! From his slog, I found that he also had a lot to say about recursion. He think that there are some certain frames for the recursion functions. And list out some of them. To be honest, I don't think always looking for framework is a good idea, as there are so many different cases. However, her ideas of summarizing really makes me think. It is a really good way to learn not only CSC but also other courses.
By the way, I've looked many urls on the slog lists. Some of them even doesn't include the week 11's slog and made me difficult to find a slog which I can refer to, but this one is like a real treasure for me. I think I can learn a lot from this slog. And I also strongly recommend this slog to everyone!
Monday, 30 March 2015
Sunday, 22 March 2015
Week10: A start of A3 and something about variable name
There are no tutorials, no assignment dues, no tests during this week, so this week was not so tough.
During the lectures, I got some information about the assignment 3, and I also learned something about the variable name.
As for the assignment 3, there are two ways to finish this assignment, but in either way, we should learn how to reduce the runtime by avoiding some useless steps. Indeed, when I used my recursive functions, it ran really slowly and in this case, I never succeeded in running a 4 * 4 grid. These improvement will help our functions to work better, and maybe that will make it possible for our functions to run in a 4 * 4 grid. In fact, I have some questions about how to judge whether an improvement can reduce the runtime considerably. I think we will soon learn how to do it.
And as for the variable name. I learned that the if we set a global variable A, and we also set a parameter A for a function. then the function will first refer to the parameter A, rather than the global variable A. That is vital for us, as this may lead to some unexpected error during the running of the program.
The problem I encountered during this week was that I didn't know how to calculate the runtime. I asked one of my friend who had this course before. He told me that I just need to approximately determine what type the function was, and didn't have to add every constant, that made me feel much easier to calculate the runtime.
The problem I encountered during this week was that I didn't know how to calculate the runtime. I asked one of my friend who had this course before. He told me that I just need to approximately determine what type the function was, and didn't have to add every constant, that made me feel much easier to calculate the runtime.
This week is kind of vacant and maybe next time, I should do something by myself to get some improvement. I tried to read the required reading, but just found out that it was kind of difficult for me to understand the documentation. The notes are easier to understand, but now we have no notes. I think maybe the instructor can give us more notes to help us to learn, that will be helpful.
Sunday, 15 March 2015
Week9: Term test 2 week!
This week we had the term test 2, which was about some definitions about tree, recursive functions and linked list.
As for the definitions, I think I understood most of them, however, after checking answers with my friends, I found out that I had some misunderstanding about the arity. The arity of a tree is the max number of nodes of any trees. It means that I should find the node who has most children and count the number of its children. In the past, I thought arity represents the number of children a node can hold, which was wrong!!!
As for recursive functions, I found that although in most cases, I could work out recursive functions, under the stress of test, I become too nervous to do anything. That means my understanding of recursive functions is not good enough, otherwise, I should have worked it out easily. I should practice more to understand recursive functions better, rather than just memorizing.
In fact, I found I did really badly in linked list. It was obvious that I didn't understand the model at all!
So I found a way to deal with it. I asked some of my friends who had worked with linked lists before. They told me I had two methods to deal with linked lists. First, I may take care of my order, which can help me not to lose the front or the back of a linked list. Second, I can copy or store the front or back in advance, then I can do something to the linked list and then find back the front or back. These methods sounds good, but I still have many problems. Since there is no TA, I think I'd better ask my friends more about the method to deal with linked lists.
As for the definitions, I think I understood most of them, however, after checking answers with my friends, I found out that I had some misunderstanding about the arity. The arity of a tree is the max number of nodes of any trees. It means that I should find the node who has most children and count the number of its children. In the past, I thought arity represents the number of children a node can hold, which was wrong!!!
As for recursive functions, I found that although in most cases, I could work out recursive functions, under the stress of test, I become too nervous to do anything. That means my understanding of recursive functions is not good enough, otherwise, I should have worked it out easily. I should practice more to understand recursive functions better, rather than just memorizing.
In fact, I found I did really badly in linked list. It was obvious that I didn't understand the model at all!
So I found a way to deal with it. I asked some of my friends who had worked with linked lists before. They told me I had two methods to deal with linked lists. First, I may take care of my order, which can help me not to lose the front or the back of a linked list. Second, I can copy or store the front or back in advance, then I can do something to the linked list and then find back the front or back. These methods sounds good, but I still have many problems. Since there is no TA, I think I'd better ask my friends more about the method to deal with linked lists.
Sunday, 8 March 2015
Week8: Assignment2 about recursion and class design
The due date of assignment 2 is this Thursday, so we worked on assignment 2 this week.
I learned two main contents in the assignment.
First, more about the class design. During the assignment 1, I learned something about class design. However, I even learned more by referring to instructor's code. First, I learned that we don't need to implement a method to play game under GameState, rather, we should implement the play method under the GameView to ensure this play method can work for more game. GameState is just a class to represent a state, we just use these states under the GameView. Second, I learned that most games should have similar methods like possible_next_moves, apply_move. This can help us to play a lot of games by just implementing one GameView. In the last assignment, I obviously didn't find out many share characteristics between one game and another one.
Then, I understand recursion more. I get to know two new essential rules to make my recursion work. The first one is that I should get to know what requires the recursion, in this assignment, the return of the state or move itself, in fact, doesn't require recursion. The thing which requires recursion is the calculation of the score. Knowing what really requires recursion makes our recursion much easier. The second thing is that drawing a picture is a really good way to help us to understand recursion. At first, I didn't care about the picture on the handout. And that makes me waste a lot of time as I didn't have a method to solve the problem and I just tried over and over again. After considering about the picture carefully, I got to under the instructor's method and then it just took a few time for me to work out the problem.
I learned two main contents in the assignment.
First, more about the class design. During the assignment 1, I learned something about class design. However, I even learned more by referring to instructor's code. First, I learned that we don't need to implement a method to play game under GameState, rather, we should implement the play method under the GameView to ensure this play method can work for more game. GameState is just a class to represent a state, we just use these states under the GameView. Second, I learned that most games should have similar methods like possible_next_moves, apply_move. This can help us to play a lot of games by just implementing one GameView. In the last assignment, I obviously didn't find out many share characteristics between one game and another one.
Then, I understand recursion more. I get to know two new essential rules to make my recursion work. The first one is that I should get to know what requires the recursion, in this assignment, the return of the state or move itself, in fact, doesn't require recursion. The thing which requires recursion is the calculation of the score. Knowing what really requires recursion makes our recursion much easier. The second thing is that drawing a picture is a really good way to help us to understand recursion. At first, I didn't care about the picture on the handout. And that makes me waste a lot of time as I didn't have a method to solve the problem and I just tried over and over again. After considering about the picture carefully, I got to under the instructor's method and then it just took a few time for me to work out the problem.
Sunday, 1 March 2015
Week7: Summary on Recursion
I've been exposed to a new topic recursion for a few weeks and here is some of my understandings for it.
Why recursion works?
Recursion is not a magic and it is not a special grammar in python in my opinion, it is just about using the function over and over again just as the instruction the programmer gave, and at last, use the base case to solve it.
Are all the functions that contain themselves recursive function?
No! Sometimes, we may encounter with some __repr__ functions where there are another __repr__ in the function body. However, they are obviously not recursive functions. They are just using this function in other classes. A recursive function should contain a base case, so a good way to judge whether it is a recursive function or not is to find out whether it has a base case.
How to write a recursive function?
To write a recursive function, we can trace back. However, it is not so easy to write a recursive function in this method. Rather, we first think about the base case. We think about the simplest case where no recursion is required to write the base case. And then, we can regard those function calls for simple cases as what we already know and try on cases which just requires one recursion. At last, We may trace back to see whether our function works.
Above are some of my understands for recursion. Although I get used to recursion to some degree, I still have troubles dealing with recursive functions. I think the way to solve it is to try on more lab problems and ask my friends and TAs(Hope we will have TAs help us soon)
Why recursion works?
Recursion is not a magic and it is not a special grammar in python in my opinion, it is just about using the function over and over again just as the instruction the programmer gave, and at last, use the base case to solve it.
Are all the functions that contain themselves recursive function?
No! Sometimes, we may encounter with some __repr__ functions where there are another __repr__ in the function body. However, they are obviously not recursive functions. They are just using this function in other classes. A recursive function should contain a base case, so a good way to judge whether it is a recursive function or not is to find out whether it has a base case.
How to write a recursive function?
To write a recursive function, we can trace back. However, it is not so easy to write a recursive function in this method. Rather, we first think about the base case. We think about the simplest case where no recursion is required to write the base case. And then, we can regard those function calls for simple cases as what we already know and try on cases which just requires one recursion. At last, We may trace back to see whether our function works.
Above are some of my understands for recursion. Although I get used to recursion to some degree, I still have troubles dealing with recursive functions. I think the way to solve it is to try on more lab problems and ask my friends and TAs(Hope we will have TAs help us soon)
Subscribe to:
Posts (Atom)