A stack is a container of objects that are inserted (push) and removed(pop) according to last-in-first out (LIFO)principle. In this sense it is a limited access data structure. Physical example would be a stack of books.
Here is a picture of a stack.
A python list can be used in a stack. Although Python does not have push(), it has append() which serves the same purpose as far as a stack implementation is concerned.
PythonStack
Here is a picture of a stack.
A python list can be used in a stack. Although Python does not have push(), it has append() which serves the same purpose as far as a stack implementation is concerned.
PythonStack
No comments:
Post a Comment