SlideShare a Scribd company logo
STACK
Data Structure
www.btechsmartclass.com
What is a STACK ?
A stack is a container of elements that are inserted
and
removed according to the last-in first-out (LIFO)
principle.
A stack is a ordered list of elements of same data
type
A stack is a Linear list
What is a STACK ?
0 1 2 3 4
In a stack all operation like
insertion and deletion are
performed at only one end
called Top
What is a STACK ?
In a stack all operation like
insertion and deletion are
performed at only one end
called Top
1
2
3
4
0
Insertion Deletion
Top
Operations on STACK ?
Insertion
Deletion
Displaying
Creation
Operations on STACK ?
Insertion
Deletion
Displaying
Creation #define SIZE 5
int stack[SIZE];
1
2
3
4
0
stack
Operations on STACK ?
Insertion
Deletion
Displaying
Creation
void push(element){
if(Stack is full)
{
printf(“FULL!!!”);
}
else
{
Top++;
stack[Top] = element;
}
}
1
2
3
4
0
stack
Insertion operation is called as “push”
Operations on STACK ?
Insertion
Deletion
Displaying
Creation
int pop( ){
if(Stack is Empty)
{
printf(“EMPTY!!!”);
return Top;
}
else
{
deleted = stack[Top];
Top--;
return deleted;
}
}
1
2
3
4
0
stack
Deletion operation is called as “pop”
Operations on STACK ?
Insertion
Deletion
Displaying
Creation
void display( ){
if(Stack is Empty)
{
printf(“EMPTY!!!”);
}
else
{
for(i=Top; i>-1; i--)
printf(“%dn”,stack[i]);
}
}
1
2
3
4
0
stack

More Related Content

PPTX
DS- Stack ADT
PPTX
CS8391-Data Structures Unit 2
PDF
04 stacks
PPTX
Stack and its applications
PPTX
Ds stacks
PPTX
Stack operation algorithms with example
PPTX
6 - STACKS in Data Structure and Algorithm.pptx
PPT
Stack data structures with definition and code
DS- Stack ADT
CS8391-Data Structures Unit 2
04 stacks
Stack and its applications
Ds stacks
Stack operation algorithms with example
6 - STACKS in Data Structure and Algorithm.pptx
Stack data structures with definition and code

Similar to Stack-data-structure.ppsxErwewwwrrterewewew (20)

PPT
Lect 15-16 Zaheer Abbas
PPTX
STACK1.pptx
PPTX
Data structure Stack
PPTX
Abscddnddmdkwkkstack implementation.pptx
PPTX
introduction of the Stacks and Queues.pptx
PPTX
DSA_Unit3_ Stacks and Queues using array (1).pptx
PDF
DOCX
Stacks in data structure
PPT
Lec 4 Stack of Data Structures & Algorithms
PPT
MO 2020 DS Stacks 1 AB.ppt
PPTX
STACK is a linear data structure it follows lifo approach
PPTX
Operation on stack
PPTX
Stack and Queue.pptx university exam preparation
PPT
Lecture5
PPTX
Stack converted
PPTX
Project of data structure
PPTX
Data structure by Digvijay
PPTX
Stack PPT.pptx
PPTX
Stack project
PPTX
Stacks Data structure.pptx
Lect 15-16 Zaheer Abbas
STACK1.pptx
Data structure Stack
Abscddnddmdkwkkstack implementation.pptx
introduction of the Stacks and Queues.pptx
DSA_Unit3_ Stacks and Queues using array (1).pptx
Stacks in data structure
Lec 4 Stack of Data Structures & Algorithms
MO 2020 DS Stacks 1 AB.ppt
STACK is a linear data structure it follows lifo approach
Operation on stack
Stack and Queue.pptx university exam preparation
Lecture5
Stack converted
Project of data structure
Data structure by Digvijay
Stack PPT.pptx
Stack project
Stacks Data structure.pptx
Ad

More from RamaKrishnaErroju (18)

PPT
Fourier-Series SAMPLE PRESENTATION FOR LEARNING
PPT
311introductiontomachinelearning.ppt12345
PPTX
Day17.pptx department of computer science and eng
PPTX
Day15.pptx school of computer science and ai
PPTX
Day3 datamining recent trends and advancements
PPTX
Day2 Applications of datamining using differe
PPTX
Introduction about Applications of data mining
PPTX
Googlecolab1 tutorial for data science practise
PPTX
Data Preprocessing techniques for applications
DOCX
TEXMAKER Overview research plagrism check
DOCX
BioIn_Pap1dramaprevenbtionsakcnnshejjsja
PPTX
PLSQL_cur.pptx presentation uploadtttees
PPT
5261506.ppt
PPTX
CONVERSATION.pptx
PPT
sap-overview.ppt
PPT
PPTX
CONVERSATION.pptx
PPTX
Fourier-Series SAMPLE PRESENTATION FOR LEARNING
311introductiontomachinelearning.ppt12345
Day17.pptx department of computer science and eng
Day15.pptx school of computer science and ai
Day3 datamining recent trends and advancements
Day2 Applications of datamining using differe
Introduction about Applications of data mining
Googlecolab1 tutorial for data science practise
Data Preprocessing techniques for applications
TEXMAKER Overview research plagrism check
BioIn_Pap1dramaprevenbtionsakcnnshejjsja
PLSQL_cur.pptx presentation uploadtttees
5261506.ppt
CONVERSATION.pptx
sap-overview.ppt
CONVERSATION.pptx
Ad

Recently uploaded (20)

PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
master seminar digital applications in india
PPTX
Pharma ospi slides which help in ospi learning
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Basic Mud Logging Guide for educational purpose
PDF
Complications of Minimal Access Surgery at WLH
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
O7-L3 Supply Chain Operations - ICLT Program
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
master seminar digital applications in india
Pharma ospi slides which help in ospi learning
GDM (1) (1).pptx small presentation for students
Microbial disease of the cardiovascular and lymphatic systems
Basic Mud Logging Guide for educational purpose
Complications of Minimal Access Surgery at WLH
Supply Chain Operations Speaking Notes -ICLT Program
STATICS OF THE RIGID BODIES Hibbelers.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Module 4: Burden of Disease Tutorial Slides S2 2025
102 student loan defaulters named and shamed – Is someone you know on the list?
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf

Stack-data-structure.ppsxErwewwwrrterewewew

  • 2. What is a STACK ? A stack is a container of elements that are inserted and removed according to the last-in first-out (LIFO) principle. A stack is a ordered list of elements of same data type A stack is a Linear list
  • 3. What is a STACK ? 0 1 2 3 4 In a stack all operation like insertion and deletion are performed at only one end called Top
  • 4. What is a STACK ? In a stack all operation like insertion and deletion are performed at only one end called Top 1 2 3 4 0 Insertion Deletion Top
  • 5. Operations on STACK ? Insertion Deletion Displaying Creation
  • 6. Operations on STACK ? Insertion Deletion Displaying Creation #define SIZE 5 int stack[SIZE]; 1 2 3 4 0 stack
  • 7. Operations on STACK ? Insertion Deletion Displaying Creation void push(element){ if(Stack is full) { printf(“FULL!!!”); } else { Top++; stack[Top] = element; } } 1 2 3 4 0 stack Insertion operation is called as “push”
  • 8. Operations on STACK ? Insertion Deletion Displaying Creation int pop( ){ if(Stack is Empty) { printf(“EMPTY!!!”); return Top; } else { deleted = stack[Top]; Top--; return deleted; } } 1 2 3 4 0 stack Deletion operation is called as “pop”
  • 9. Operations on STACK ? Insertion Deletion Displaying Creation void display( ){ if(Stack is Empty) { printf(“EMPTY!!!”); } else { for(i=Top; i>-1; i--) printf(“%dn”,stack[i]); } } 1 2 3 4 0 stack