A stack is a linear data structure that operates on a Last-In-First-Out (LIFO) principle, allowing insertion and deletion only from the top. Standard operations include Push (to add an element), Pop (to remove an element), and Peek (to view an element at a specific position). The stack can enter an overflow state if there is no room for new items during a push operation.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
5 views
Stack and queue
A stack is a linear data structure that operates on a Last-In-First-Out (LIFO) principle, allowing insertion and deletion only from the top. Standard operations include Push (to add an element), Pop (to remove an element), and Peek (to view an element at a specific position). The stack can enter an overflow state if there is no room for new items during a push operation.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 4
STACK AND QUEUE
Presented By:- TANISHK SONKAR
WHAT IS STACK • A Stack is a linear data structure that follows the LIFO (Last-In-First- Out) principle. Stack has one end, whereas the Queue has two end (Front And rear). It contain only one pointer top pointer pointing to the topmost element of the stack. Whenever an element is added in the stack, it is added on the top of the stack, and the element can be deleted only from the stack. In other words, a stack can be defined as a container in which insertion and deletion can be done form the one end known as the top of the stack. STANDARD STACK OPERATIONS • Push(): when we insert an element in a stack then the operation is known an a push. • Pop(): when we delete an element form the stack, the operation in known as a pop. • Peek(): It returns the element at the given position. STACK OPERATION: PUSH Push: When we insert an element in a stack then the operation is known as a push. Adds an item at the top of the stack After the push, the new item become the top The stack is in an overflow state if there is no. room for the new item