TOPIC : INTRODUCTION OF STACK
Stack
• Stack is a linear Data Structure implemented in LIFO(Last In First
Out) manner where insertion and deletion of element are
performed only at one end i.e. top of the stack.
• It is a collection of data items in which data items are inserted and
deleted from the top of stack.
• The removal of element from stack is called POP operation.
• The insertion of new element at the top of the stack is called PUSH
operation.
• Stack is also called Dynamic Data Structure because the stack
implemented by list can grow(i.e. increase number of elements)
and shrink(i.e. decrease the number of elements)
Representation of Stack
with Push and Pop operations
Other Stack Terms
1- Overflow:- It refers to the situation when one tries to
push(insert) an item in stack that is already full. This
situation occurs when the size of stack is fixed and can
not grow or there is no memory left to accommodate
new item.
2- Underflow:- It refers to the situation when one tries to
pop(delete) an item from the empty stack.
3- Peek:- It refers to inspecting or get the value from the top
of the stack i.e. Peek means to know the topmost
element of stack
Illustrating Overflow and Underflow Condition
Illustrating Overflow and Underflow Condition

XIICSSTACK_INTRODUCTION cs

  • 1.
  • 2.
    Stack • Stack isa linear Data Structure implemented in LIFO(Last In First Out) manner where insertion and deletion of element are performed only at one end i.e. top of the stack. • It is a collection of data items in which data items are inserted and deleted from the top of stack. • The removal of element from stack is called POP operation. • The insertion of new element at the top of the stack is called PUSH operation. • Stack is also called Dynamic Data Structure because the stack implemented by list can grow(i.e. increase number of elements) and shrink(i.e. decrease the number of elements)
  • 3.
    Representation of Stack withPush and Pop operations
  • 4.
    Other Stack Terms 1-Overflow:- It refers to the situation when one tries to push(insert) an item in stack that is already full. This situation occurs when the size of stack is fixed and can not grow or there is no memory left to accommodate new item. 2- Underflow:- It refers to the situation when one tries to pop(delete) an item from the empty stack. 3- Peek:- It refers to inspecting or get the value from the top of the stack i.e. Peek means to know the topmost element of stack
  • 5.
    Illustrating Overflow andUnderflow Condition
  • 6.
    Illustrating Overflow andUnderflow Condition