This week is the last week of this semester and we have finished this class in this week, and we only left final exam for us to do. However, this course leave a deep impact on me and enriched my knowledge of how to being a computer scientist in future, and totally changes my past opinion about computer scientists and understanding of it. A computer scientist should have independent thought, that's why we'd better going to the labs to do some practice after lectures in each week. With an independent thought, we could understand the purpose of a project better and write the program easily.
We have learned several new knowledge which are much deeper than what we have learned from CSC108, which makes me feel stepping into a higher level of computer science.
Abstract data types(ADTs):
An abstract data type specifies clearly several methods and the docstrings and semantics of these operations which tell us what these methods work for, however, these operations do not particularly express the implementation of the operations, which make ADT abstract.
Class:
We define a class to help us solve problems easily with a set of methonds.
Class objects contain attributes and instantiations.The attributes in class refer to specific types of items in class.
Recursion:
"When a function calls itself, we say that it is recursive." Recursion is not the only way to solve problems, however, recursion is necessary for computer scientists because of its conciseness.
Sunday, April 5, 2015
WEEK 11: Review Past Posts
In this week, we have finished most tasks of CSC148 course. We have reviewed some knowledge we learned from CSC108, for instance, bubble sort, insertion sort and selection sort. Furthermore, we also expanded our understanding of different types of sort and developed abilities to designed new sort.
However, after revisiting my past slogs, I found what I thought about are not completed enough. Since several weeks past, for question I raised in week 4, should I keep property of father class in son class as its property or replace old property with a new son property, I should inherit the property of main class instead of replacing it. Because the son class is worked exactly for its father class, and it has same property of father class.
After learning what is class and how to design a class, we have stepped into another vital part of our lecture. Recursion can be used into designing different functions and solving time for computer to run them. In order to use recursion expertly, the first thing to do is to know what is the basic case of a function, then consider all possible conditions during the function is running. Moreover, it's important to know attributes of class so that recursion is writting in a correct way.
However, after revisiting my past slogs, I found what I thought about are not completed enough. Since several weeks past, for question I raised in week 4, should I keep property of father class in son class as its property or replace old property with a new son property, I should inherit the property of main class instead of replacing it. Because the son class is worked exactly for its father class, and it has same property of father class.
After learning what is class and how to design a class, we have stepped into another vital part of our lecture. Recursion can be used into designing different functions and solving time for computer to run them. In order to use recursion expertly, the first thing to do is to know what is the basic case of a function, then consider all possible conditions during the function is running. Moreover, it's important to know attributes of class so that recursion is writting in a correct way.
Sunday, March 22, 2015
Week 10: Impression of week 9 and week 10
In week 8,
we have discussed about what is a wrapper class and the function of it. To
understand the concept of wrapper class well, we also have talked about how to use a wrapper function in real class
writing, for instance, writing a LinkedList class, which is a wrapper function
of LLNode classes and understanding how walk along in it.
In week 9, we make a further discussion about wrapper class, which is how to write a seen a BTNode as a wrapper class and rewrite several basic functions in it.
In week 9, we make a further discussion about wrapper class, which is how to write a seen a BTNode as a wrapper class and rewrite several basic functions in it.
In week 10,
Danny helped us analyzing strategies of our assignment 2 and introduced some
new ideas to make our assignment 3 into a further step, which is help computer
decreasing useless consideration and repeated steps. The first step, which I think it's useful, for
us is to understand the function of strategy and make it delicate is to draw a
tree of whole possible moves of subtract square game between two players. After drawing whole tree of possible moves in subtract square game, I found that there are some repeated game state during this game which will come to a fixed ending for each of two players,which
means we can tell computer do not run these repetitive so that it can save run
times of the class.
Saturday, March 14, 2015
Week 9: Linked List - impression of week 8
I have learned a new class which is about write linked list.
Although the linked list is called as a list, it is not a real list as what we have learned before. What I think that a list should looks like is it should be with two square brackets. However, we can still view linked list as a special list without any square brackets. The linked lists are lists made up of an item(or value) and a sub-list, this sub-list is also a linked list which is made up of its own value and a sub-sublist and so on. In addition, we can view linked lists as a node with a value and a reference to other objects which may also be a node of linked list.
Although the linked list is called as a list, it is not a real list as what we have learned before. What I think that a list should looks like is it should be with two square brackets. However, we can still view linked list as a special list without any square brackets. The linked lists are lists made up of an item(or value) and a sub-list, this sub-list is also a linked list which is made up of its own value and a sub-sublist and so on. In addition, we can view linked lists as a node with a value and a reference to other objects which may also be a node of linked list.
A linked list is a linear sequence of nodes. However, in this case, we pick the second idea of linked list. So we defined two class to build a wrapper class of a LLNode class and a LinkedList class. In order to track and view linked list well, we keep a reference to the front (we may called self.front in LLNode)of a sequence. We call the tail item of a linked list back.
In Linkedlist, we may need to make some changes of items in LLNode. That's to say, we will walk along a list. To find what we are looking for and make change of it, we are required to record previous part and current part of node which means waling along a list with two references.
Saturday, March 7, 2015
WEEK 8: Impression of Week 7
On week 7, I've learned what is a Tree class and a binary tree which is a type of tree with only two branching factors. A binary tree usually has children called left and right child.
In the lecture, we use a BTNode to study a binary tree. This BTNode class is a binary tree that left children in each node(can be viewed as a parent of a subtree) is smaller than right children in that node. What I need to do to understand BTNode first is to understand the functions in the basic Tree class.
contains(t,v): is used to determined whether the value v is in the tree t, or the tree t may has no children and whether value v is eaqual to tree t itself.
height(t): is used to tell users the height of total tree. What we should know is that the value of height of a tree is equal to number of branches plus one.
descendents_from_list(t, L, arity): is to populate tree t's descendents from L. Arity is a integer which tell users the number of children of each level node.
In BTnode class, we learned how wo add children or new node in Tree. Visiting each node and do something at each node is called traversal. In-order traversal is to visit a node between visiting its two children.
To finish lab06, we need to know the job of is_leaf(node) function and how to use it. is_leaf(node) function is a helper function to help each function to determine whether Tree has children or not. If the tree node is not a leaf, we can use recursion to help each function run to get final result.
In the lecture, we use a BTNode to study a binary tree. This BTNode class is a binary tree that left children in each node(can be viewed as a parent of a subtree) is smaller than right children in that node. What I need to do to understand BTNode first is to understand the functions in the basic Tree class.
contains(t,v): is used to determined whether the value v is in the tree t, or the tree t may has no children and whether value v is eaqual to tree t itself.
height(t): is used to tell users the height of total tree. What we should know is that the value of height of a tree is equal to number of branches plus one.
descendents_from_list(t, L, arity): is to populate tree t's descendents from L. Arity is a integer which tell users the number of children of each level node.
In BTnode class, we learned how wo add children or new node in Tree. Visiting each node and do something at each node is called traversal. In-order traversal is to visit a node between visiting its two children.
To finish lab06, we need to know the job of is_leaf(node) function and how to use it. is_leaf(node) function is a helper function to help each function to determine whether Tree has children or not. If the tree node is not a leaf, we can use recursion to help each function run to get final result.
Sunday, March 1, 2015
Week 7 Summary of Recursion
I've learned and are using both 'For' loops and 'While' loops in some functions to solve several problems that have finite steps. However, it's hard to design functions which have infinite steps and it is also hard for us to make an accurate extimation on how many steps the functions would proceed. The professor introduced us a much easier way to simplify complex functions from a huge size to a delicate structure which make uses understand easily and make computer run programs much faster. That's recursion.
As what I wrote in slog of last week, "when a function calls itself, we say that is a recursive.", which means this function use recursion strategy in itself.
At the beginning of the lecture of recursion, we've learned how to understand recursive data structure. A recursive data stracure always contains some substrures and itself.
Adding the statement into the functions which make functions call themselves calls recursive call. A feasible recursive call contains a base case and other cases and also a case make function recall itself. It's significantly important to built a base case in funtion. Because missing a basic case, which is similar as setting conditions for 'while' loops,will result in infinite loops of functions.
In recent lectures, I've learned how to use recursion in real problems such as Tree classes.
As what I wrote in slog of last week, "when a function calls itself, we say that is a recursive.", which means this function use recursion strategy in itself.
At the beginning of the lecture of recursion, we've learned how to understand recursive data structure. A recursive data stracure always contains some substrures and itself.
Adding the statement into the functions which make functions call themselves calls recursive call. A feasible recursive call contains a base case and other cases and also a case make function recall itself. It's significantly important to built a base case in funtion. Because missing a basic case, which is similar as setting conditions for 'while' loops,will result in infinite loops of functions.
In recent lectures, I've learned how to use recursion in real problems such as Tree classes.
Recursion is a good strategy to solve problems like class Tree. When we are facing problems like "subitems contain subitems contain subitems....."(this is a recursive data structure), we use recursion which is based on a solid base case to recall infinite times of problems themselves untill we operate whole possible processes in structure.
What I think is a challenge for me is how to determine a correct and precise position to put my recursion. It's easily for my to forget put recursion in function and put correct recursion in 'return'. What should I do in future to overcome these challenge is to do more extra exercise so that I can master this strategy more easily.
Tuesday, February 17, 2015
Week 6: Object-oriented Programming Concepts
Sorry for posting late.
For all materials what we have learned from past six weeks, our main task and purpose is to learn how to design a class by ourselves. There are several concepts that oriented us to do programming.
Abstract data types(ADTs):
An abstract data type specifies clearly several methods and the docstrings and semantics of these operations which tell us what these methods work for, however, these operations do not particularly express the implementation of the operations, which make ADT abstract.
As a typical abstract data type, stack is a last in,first out data structure, which means you removed the first item you inserted, then add it to the last position. Stack works with __init__, push, pop and is_empty these four interface operations. After implementating these methods, stack can help other classes run.
Class:
We define a class to help us solve problems easily with a set of methonds.
Class objects contain attributes and instantiations.The attributes in class refer to specific types of items in class. For example, self.point refers to the coordinate of a point which could be expressed as a tuple of two integers. The class instantiations are to return new instance which is our desired result through using some functions and methods.
Futhermore, we also learned class inheritence(subclass), which is to design a parent class that contains all general methods and instances and one son class or several subclasses to do specific works. For example, what I've done in my first assignment with my group members is to design a general game class which contains general game state, such as players' turn, state of moving and so on. Then we implemented subclasses for a substract square game. In next assignment, we will design subclasses for a new game based on our past parent main class, general game class. And we also need to raise exceptions to let users of class to know that if they want to run specific subclass, they need to inplemented relevant missing materials.
Recursion:
"When a function calls itself, we say that it is recursive." Recursion is not the only way to solve problems, however, recursion is necessary for computer scientists because of its conciseness.
Recursion data structures: usually are composed of simple instances of themselves, for instance, list of numbers, and nested number lists.
References:
[1] Posted slides from course website.
[2] https://docs.python.org/3/tutorial/classes.html
For all materials what we have learned from past six weeks, our main task and purpose is to learn how to design a class by ourselves. There are several concepts that oriented us to do programming.
Abstract data types(ADTs):
An abstract data type specifies clearly several methods and the docstrings and semantics of these operations which tell us what these methods work for, however, these operations do not particularly express the implementation of the operations, which make ADT abstract.
As a typical abstract data type, stack is a last in,first out data structure, which means you removed the first item you inserted, then add it to the last position. Stack works with __init__, push, pop and is_empty these four interface operations. After implementating these methods, stack can help other classes run.
Class:
We define a class to help us solve problems easily with a set of methonds.
Class objects contain attributes and instantiations.The attributes in class refer to specific types of items in class. For example, self.point refers to the coordinate of a point which could be expressed as a tuple of two integers. The class instantiations are to return new instance which is our desired result through using some functions and methods.
Futhermore, we also learned class inheritence(subclass), which is to design a parent class that contains all general methods and instances and one son class or several subclasses to do specific works. For example, what I've done in my first assignment with my group members is to design a general game class which contains general game state, such as players' turn, state of moving and so on. Then we implemented subclasses for a substract square game. In next assignment, we will design subclasses for a new game based on our past parent main class, general game class. And we also need to raise exceptions to let users of class to know that if they want to run specific subclass, they need to inplemented relevant missing materials.
Recursion:
"When a function calls itself, we say that it is recursive." Recursion is not the only way to solve problems, however, recursion is necessary for computer scientists because of its conciseness.
Recursion data structures: usually are composed of simple instances of themselves, for instance, list of numbers, and nested number lists.
References:
[1] Posted slides from course website.
[2] https://docs.python.org/3/tutorial/classes.html
Sunday, February 8, 2015
Week 5: First Midterm
We finished our first midterm in week 5. During the test, this series of learning and practical application in past 5 weeks, I found that a lot of their own inadequencies because I didn't respond to test questions immediately and what we tested in our midterm were just about our lab materials. I feel disappointed with myself.
In our fourth lab, we have started a new materials we have learnt from lecture in this week what is about test and unittest which we partly learnt in CSC108 lectures. Test is one of the most significant steps in programming, that's to say, a completed program is required to pass in various problems regions and all special cases. Therefore, a intergral set of problem cases is determined by a clear classification for different types of special cases.
Sunday, February 1, 2015
Week 4: Review and Question
In these
four weeks, I have expanded what I have
learned about how to write class from CSC108. That's to say, I should know how
to apply what I have know about writing class to solve real problems in our
live. As what our assignment 1 required us to do, what we should do is to design several
classes to run a game or several different games in the future. These classes
contained both main class and subclass. To design these classes well, it's
important to know relationship between main class and sub class and also have
clear comprehension of what subclass inherits from main class and what should
it do with its own work.
However,
when I worked with my partners, at the beginning of our assignment, we both
misunderstood the main purpose of our assignment. Because what the instruction
told us was to design five specific classes to finish whole construction of
subtract-square game, whereas we thought we can finish this game by exactly one
class and ignored the importance of subclass and continuity of our assignment.
Fortunately, I've asked Diane and she gave us a comprehensive understanding of
this assignment. What I and my partners should pay high attention to is to read
our instruction of assignment carefully so that we could avoid unwanted and
stupid mistakes.
Since the
first midterm is coming, I should make careful review of what I have learnt
from the lectures and mistakes of this assignment. And I also have a question
about subclass. For the property of subclass itself, should it write as name of
subclass itself or inherit from main class?(e.g., In __init__ of subclass, can
it be written like '(Employee) -> Nonetype' or '(HourlyEmplyee) ->
Nonetype' ?)
Sunday, January 25, 2015
Week 3 Why geeks should write?
Why geeks should write? I understand this question as the same meaning as 'what do geeks write for'.
So, what do geeks write for? In our daily life, there are many calculations that require human beings to take a huge amount of computing to solve them. These massive calculations are so complex and time-consuming that make people easily get wrong and inaccurate result so that need to be calculated again. That's to say, it's hard for human being to finish such complicated calculation with high-efficiency while computer can solves these kind of complex calculations efficiently. However, computers have no abilites to find ways to calculate themselves without initial setting by humans, which means human 'teach' computers to slove these problems. Futhermore, those computer softwares and cellphone applications which we are using in our life are written by geeks to make us live with more convenience. This is the first answer for the topic question.
The second answer, which plays the most important role on writing process, is to find and write a strategy for computer to make calculation in new methond run much more fast than in past ways. It is easy to find that different applications or softwares which have same function may run with various speed in different version, this is because new version of the softwares has been developed by geeks so that geeks undate new strategies and remove errors from last version.
What I have done and will do in my assignments will reflect these two answers for this topic question. I design several classes for running some games and I will improve these classes in future to make computer much clever so that I can choose a game strategy which I prefer to play with my opponent.
So, what do geeks write for? In our daily life, there are many calculations that require human beings to take a huge amount of computing to solve them. These massive calculations are so complex and time-consuming that make people easily get wrong and inaccurate result so that need to be calculated again. That's to say, it's hard for human being to finish such complicated calculation with high-efficiency while computer can solves these kind of complex calculations efficiently. However, computers have no abilites to find ways to calculate themselves without initial setting by humans, which means human 'teach' computers to slove these problems. Futhermore, those computer softwares and cellphone applications which we are using in our life are written by geeks to make us live with more convenience. This is the first answer for the topic question.
The second answer, which plays the most important role on writing process, is to find and write a strategy for computer to make calculation in new methond run much more fast than in past ways. It is easy to find that different applications or softwares which have same function may run with various speed in different version, this is because new version of the softwares has been developed by geeks so that geeks undate new strategies and remove errors from last version.
What I have done and will do in my assignments will reflect these two answers for this topic question. I design several classes for running some games and I will improve these classes in future to make computer much clever so that I can choose a game strategy which I prefer to play with my opponent.
Subscribe to:
Posts (Atom)





