Advantages and disadvantages of stack
A stack is used to implement LIFO (last in, first out) storage of data. The act of storing things on the stack is commonly known as "pushing" and the act of removing things from the stack is know as "popping". An example how a stack would work when storing some numbers:
Push 4
Push 7
Push 5
Push 9
First pop operation return 9
Second pop returns 5
Third pop returns 7
Fourth pop returns 4
Any additional pop request will result in an error. Notice that the elements were returned in the opposite order that they were stored in.
Push 4
Push 7
Push 5
Push 9
First pop operation return 9
Second pop returns 5
Third pop returns 7
Fourth pop returns 4
Any additional pop request will result in an error. Notice that the elements were returned in the opposite order that they were stored in.
Advantages and disadvantages of stack
In data structure stack mean a bundle. E.g. A stacks of data in a table, A stack of books, A stack of CDs.