What are stack operations in Data Structure?

Page 1

What are stack operations in Data Structure?

A Stack in Data Structure is an abstract data type that acquires an ordered and linear sequence of elements. A stack is a First in Last out (FILO) data structure in which the item that is added first will be deleted last. In a stack, the elements are arranged in a sequence manner and thus they are called linear data structures. Stack operations in data structure like PUSH (insertion of an element) and POP (deletion of an element) are performed at the top of the stack. Real-life examples of stacks are:   

Arrangement of plates: A plate can be added or removed from the top of the stack Arrangement of books in a cupboard: You can insert and remove a book only from the top of stack. Wearing and removing bangles from hand.

Various types of Stack operations: The most basic operations of the stack in the data structure are the following: push() - Adds an item at the top of the stack. It is an overflow if the stack is full. pop() - Deletion of an item from the top of the stack. If the stack is empty, then it is an underflow. peek() - Topmost element in the stack is displayed.


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.