Stacks
Stacks
Stacks
Mrs. P. S. Mahajan
Lecturer in Computer Engineering
Government polytechnic Thane
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 ends
(front and rear).
*It contains 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 from the one
end known as the top of the stack.
Stack
Primitive Operations on
Stack
*push(): When we insert an element in a stack then the
operation is known as a push. If the stack is full then the
overflow condition occurs.
*Reversing a List
*Conversion of Infix to Postfix expression
*Evaluation of Postfix Expression
*Conversion of Infix to Prefix expression
*Evaluation of Prefix Expression
*Recursion
*Tower of Hanoi
Thank You