2016年3月10日星期四
tree (week 8 )
Tree is more like a useful tool for us to do research. I think the most important feature we use tree is to sort a list of data. When we save a list of data using tree, or binary search tree, it is easy for us to do anything we want to this list of tree such as finding a specific number or remove it. Another benefit about tree I think is it is really fast, it can save a lot of time doing what clients want to do.
2016年2月25日星期四
recursion(week 7)
As the class processes on, we began to learn algorithm. recursion is a really interesting way to write program. I have found that we could use some simple but talented way to rewrite some complex code. When we use recursion, only few codes we need to write, and computer finishes anything left. it is really a new experience for me to write code. And this algorithm really gives me a new way to think how we should write code and how computer could do.
It's different with C or pascal, I found out that Python is really a better language. It's convenient and clear to show and let us understand how to write and figure out how computer works. But sometimes I still have to figure out these three different language. I often mass them up and make my codes incorrect. It's so lame.
The most important concept I learn is to use the function in the function.
ex:
if instance(L, list):
return max([rec_max(x) for x in L])
else:
return L
This is a convenient way to write recursion but it's hard for me to think about it.
Also, the dot product I learn during the TUT is helpful to understand the concepts and how we write loop in a different, efficiency way.
It's different with C or pascal, I found out that Python is really a better language. It's convenient and clear to show and let us understand how to write and figure out how computer works. But sometimes I still have to figure out these three different language. I often mass them up and make my codes incorrect. It's so lame.
The most important concept I learn is to use the function in the function.
ex:
if instance(L, list):
return max([rec_max(x) for x in L])
else:
return L
This is a convenient way to write recursion but it's hard for me to think about it.
Also, the dot product I learn during the TUT is helpful to understand the concepts and how we write loop in a different, efficiency way.
linked list(week6)
Linked lists are a dynamic data structure, which can grow and be pruned, allocating and deallocating memory while the program is running. We learn how to create it by writing two classes, class linked_node and class linked_list while linked_list is a subclass of linked_node.
And there are totally four parameters we have to think about, value, next, front and back.
Insertion and deletion node operations are easily implemented in a linked list by creating 'def append' and 'def deleted'. Also, we can also decide the position where we insert or delete.
Linear data structures such as stacks and queues are easily executed with a linked list.They can reduce access time and may expand in real time without memory overhead
2016年2月11日星期四
test (Week 5)
The first term test seems easy, but I still have struggling on how to write a blueprint of the whole program. I am confused about how to set up different functions into different classes. Sometimes I just can't figure out If I have to create a new subclass or not.
abstract data type and stack(Week 4)
The abstract data type is a new thing we learnt this week. It is a mathematical model for a certain class of data structures that have similar behaviour. The stack is a specific thing we are getting to. There are three basic functions we are using usually, push, top, pop.
I think the between with stack and queue is that stack is first in first out, queue is first in last out. but sometimes I still confused about how actually we could create a stack or queue with python and use them.
I think the between with stack and queue is that stack is first in first out, queue is first in last out. but sometimes I still confused about how actually we could create a stack or queue with python and use them.
2016年1月28日星期四
First SLOG(Week 3)
Some basic conceptions:
Object:
It is a program related state and behaviour.
Class:
A class is a blueprint or prototype from which objects are created. So it is a main program that tells what this whole program works and wants to show. It intentionally focuses on the basics, showing how even a simple class can cleanly model state and behaviour.
inheritance:
It provides a powerful and natural mechanism for organizing and structuring software. Class "inherit" and extend from superclass-- main class. And this is how we create subclass.
interface:
When a class implements an interface, it provides the behaviour published by that interface.
package:
It is a namespace for organizing classes and interfaces in a logic manner which will make the program easier.
Stack: In my own understanding, I think stack is first in last out, means that the first thing we put in is at the end of this stack and we can not take it out.
Queue: Opposite with stack, queue is first in first out. The first thing we put in is the first thing we take out.
Object:
It is a program related state and behaviour.
Class:
A class is a blueprint or prototype from which objects are created. So it is a main program that tells what this whole program works and wants to show. It intentionally focuses on the basics, showing how even a simple class can cleanly model state and behaviour.
inheritance:
It provides a powerful and natural mechanism for organizing and structuring software. Class "inherit" and extend from superclass-- main class. And this is how we create subclass.
interface:
When a class implements an interface, it provides the behaviour published by that interface.
package:
It is a namespace for organizing classes and interfaces in a logic manner which will make the program easier.
Stack: In my own understanding, I think stack is first in last out, means that the first thing we put in is at the end of this stack and we can not take it out.
Queue: Opposite with stack, queue is first in first out. The first thing we put in is the first thing we take out.
订阅:
博文 (Atom)