2015年2月28日星期六

SLOG 5

Last week I talked about the concept of Object-Oriented Programming, so I may talk about the concept of ADT this week. I’m afraid I cannot explain it very well, since I still have a lot of questions on it.

What does ADT mean? It means Abstract Data Type, literally. But this name still cannot tell anything to a guy who does know computer science. The basic concept of ADT is a Stack that can be modified by adding or deleting the elements. Actually, we can only add or delete the first and last element of a Stack. 
This picture shows the basic meaning of Stack.

We can realize the modification by using the methods push and pop. For example, if there is a Stack like this: S = [1,2,3,4,5], we can push an element to the last of the list if we write S.append (6). Similarly, we can remove the 1 by the code S.pop (0).

没有评论:

发表评论