Stack (Abstract Data Type) Part 1 Notes
Posted by JanWan
Last Updated: April 04, 2012

Stack (Abstract Data Type) 


Simple representation of a stack

In computer science, a stack is a last in, first out (LIFOabstract data type and linear data structure. A stack can have any abstract data type as an element, but is characterized by two fundamental operations, called push and pop. The push operation adds a new item to the top of the stack, or initializes the stack if it is empty. If the stack is full and does not contain enough space to accept the given item, the stack is then considered to be in an overflow state. The pop operation removes an item from the top of the stack. A pop either reveals previously concealed items, or results in an empty stack, but if the stack is empty then it goes into underflow state (It means no items are present in stack to be removed).

A stack is a restricted data structure, because only a small number of operations are performed on it. The nature of the pop and push operations also means that stack elements have a natural order. Elements are removed from the stack in the reverse order to the order of their addition: therefore, the lower elements are those that have been on the stack the longest.

Notes continue in the next blog:

History of Stack (Abstract Data Type (ADT)) 



Great! Keep it going.....