A stack is a data structure that resembles a stack of trays in a spring loaded bin.
A tray will be added to the bin on top of the stack. When you add a tray, the previous one on top will go down by one position.
You can add trays till the first trays reach the bottom of the stack. Similarly, a tray can be removed only from the top of the stack.
In the computer science item is nothing but a data element or an object.
Therefore a stack is a list in which items are added, deleted or examined at one only one end.
The size of the stack is defined by the user before compilation and hence this is a static data structure.
It adopts LIFO (last in first out ) methodology for storage and retrieval.
A tray will be added to the bin on top of the stack. When you add a tray, the previous one on top will go down by one position.
You can add trays till the first trays reach the bottom of the stack. Similarly, a tray can be removed only from the top of the stack.
In the computer science item is nothing but a data element or an object.
Therefore a stack is a list in which items are added, deleted or examined at one only one end.
The size of the stack is defined by the user before compilation and hence this is a static data structure.
It adopts LIFO (last in first out ) methodology for storage and retrieval.
If you enjoyed this post, make sure you subscribe to my RSS feed!
Post a Comment