0% found this document useful (0 votes)
20 views2 pages

Stack (Abstract Data Type) : Pushdown (Exercise)

A stack is an abstract data type that follows the LIFO (last-in, first-out) principle. It allows two principal operations - pushing an element onto the stack and popping an element off the stack. When an element is pushed onto the stack, it is placed on top of any existing elements. The popped element is always the topmost element, most recently pushed onto the stack. A stack may overflow if an element is pushed onto a full stack or underflow if an element is popped from an empty stack.

Uploaded by

kundikushoo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

Stack (Abstract Data Type) : Pushdown (Exercise)

A stack is an abstract data type that follows the LIFO (last-in, first-out) principle. It allows two principal operations - pushing an element onto the stack and popping an element off the stack. When an element is pushed onto the stack, it is placed on top of any existing elements. The popped element is always the topmost element, most recently pushed onto the stack. A stack may overflow if an element is pushed onto a full stack or underflow if an element is popped from an empty stack.

Uploaded by

kundikushoo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Stack (abstract data type)

From Wikipedia, the free encyclopedia


"Pushdown" redirects here. For the strength training exercise, see Pushdown (exercise).

This article includes a list of references, but its sources remain unclear because it has insufficient inline citations.Please help to improve this article by introducing more precise citations. (September
2009)

Simple representation of a stack In computer science, a stack is a particular kind of abstract data type or collection in which the principal (or only) operations on the collection are the addition of an entity to the collection, known as push and removal of an entity, known as pop.[1] The relation between the push and pop operations is such that the stack is a Last-In-First-Out (LIFO) data structure. In a LIFO data structure, the last element added to the structure must be the first one to be removed. This is equivalent to the requirement that, considered as a linear data structure, or more abstractly a sequential collection, the push and pop operations occur only at one end of the structure, referred to as the top of the stack. Often a peek or top operation is also implemented, returning the value of the top element without removing it. A stack may be implemented to have a bounded capacity. If the stack is full and does not contain enough space to accept an entity to be pushed, 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, it goes into underflow state, which 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.[2]

You might also like