The essential principle of thesStack data structure is "LIFO _ Last In First Out". The last item that is PUSHED into the stack is the first item that will be POPPED out.
In Python, the built-in list data structure, has the append() function that can be used as PUSH function of a stack; it also has the pop() function that can be used as POP function of a stack.
The following source code demonstrates the usage of Python list as a stack.
No comments:
Post a Comment