SlideShare uma empresa Scribd logo
1 de 10
STACK DATASTRUCTURE
BY:
KAVYA
STACK
• Stack is a,
Last in First Out or First in Last out,
Linear,
Non-primitive,
Data +Structure.
What exactly these points are, lets elaborate one by one in
bottom up approach
Data Structure: is a specialized format for organizing and storing the data in memory
and accessing the data from the memory
Classification of Data Structure
Definition of Data Structure also defined as, process of storing and accessing the
stored data from the memory in very efficient manner, efficiency in the matter of
space and time
Primitive Data Structure:
-data structures that are directly operated upon the machine-level instructions
-i.e., data structure which supports the basic data types such as: int, float, char, pointers,
constants.
Non-primitive Data Structure:
- Data structures are derived from the primitive data structures
-Structuring the group of homogeneous (same data type) or heterogeneous(different data
type)
Examples: Arrays, List, Files
Non-Primitive classified into 2 types:
1.Linear:
data structure which support homogeneous data elements.
data elements are stored in the memory sequentially in other words there is
adjacency link between the data elements
examples: Stack, Queue, Linked list
2.Non-Linear:
data items are connected to several other items.
relationship between the data elements are in the fashion of parent-child
examples: Graph, Tree
Stack is linear data structure which follows a particular order in
which the operations are performed.
EXAMPLES:
•STACK OF BOOKS ON DESK
•STACK OF PLATES IN A CAFETERIA
•STCAK OF COINS,CHAIRS,ETC..,
OPERATIONS ON STACK
•PUSH(): Place a new element into the stack. The value provided
becomes the new topmost item in the stack
•POP(): Remove the topmost item from the stack.
PUSH()
ALGORITHM TO PUSH AN ELEMENT ONTO STACK
PUSH(S,TOP,SIZE,ITEM)
1.IF TOP == MAX THEN
write(‘stack is full or overflow’) and exit
2. TOP=TOP+1
3. S[TOP]=ITEM
4. EXIT
POP()
ALGORITHM TO POP AN ELEMENT ONTO STACK
POP(S,TOP,SIZE)
1.IF TOP == -1 THEN
write(‘stack is EMPTY or UNDERFLOW’) and exit
2. VALUE=S[TOP]
3. TOP=TOP-1
4. EXIT
APPLICATIONS OF STACK
•Back and Forward Buttons in a Web Browser
•Undo and Redo button of MS-word
•Evaluating Arithmetic operations
•Recursion
THANK YOU

Mais conteúdo relacionado

Mais procurados

Data structures and Alogarithims
Data structures and AlogarithimsData structures and Alogarithims
Data structures and Alogarithims
Victor Palmar
 
Data structure
Data structureData structure
Data structure
Mohd Arif
 
Introductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueIntroductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, Queue
Ghaffar Khan
 

Mais procurados (20)

Data structure and its types.
Data structure and its types.Data structure and its types.
Data structure and its types.
 
Data structures and Alogarithims
Data structures and AlogarithimsData structures and Alogarithims
Data structures and Alogarithims
 
Data structure
Data structureData structure
Data structure
 
Introduction To Data Structures.
Introduction To Data Structures.Introduction To Data Structures.
Introduction To Data Structures.
 
Lecture1 data structure(introduction)
Lecture1 data structure(introduction)Lecture1 data structure(introduction)
Lecture1 data structure(introduction)
 
Data structures Lecture no. 2
Data structures Lecture no. 2Data structures Lecture no. 2
Data structures Lecture no. 2
 
Data Structure using c language for beginners
Data Structure using c language for beginners Data Structure using c language for beginners
Data Structure using c language for beginners
 
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure ppt
 
Data structures Lecture no.3
Data structures Lecture no.3Data structures Lecture no.3
Data structures Lecture no.3
 
Introduction of Data Structure
Introduction of Data StructureIntroduction of Data Structure
Introduction of Data Structure
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
 
Data structure
Data structureData structure
Data structure
 
Introductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueIntroductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, Queue
 
data structure
data structuredata structure
data structure
 
Data structures lectures no 1
Data structures lectures no 1Data structures lectures no 1
Data structures lectures no 1
 
data structure
data structuredata structure
data structure
 
Data Structures - Lecture 2 [Introduction to Data Structures]
Data Structures - Lecture 2 [Introduction to Data Structures]Data Structures - Lecture 2 [Introduction to Data Structures]
Data Structures - Lecture 2 [Introduction to Data Structures]
 
Data structure & its types
Data structure & its typesData structure & its types
Data structure & its types
 
General Data structures
General Data structuresGeneral Data structures
General Data structures
 
Types Of Data Structure
Types Of Data StructureTypes Of Data Structure
Types Of Data Structure
 

Semelhante a Introduction to stack

Semelhante a Introduction to stack (20)

Stack Data Structure
Stack Data StructureStack Data Structure
Stack Data Structure
 
Data structure
Data structureData structure
Data structure
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptx
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptx
 
TSAT Presentation1.pptx
TSAT Presentation1.pptxTSAT Presentation1.pptx
TSAT Presentation1.pptx
 
Data Structures and algoithms Unit - 1.pptx
Data Structures and algoithms Unit - 1.pptxData Structures and algoithms Unit - 1.pptx
Data Structures and algoithms Unit - 1.pptx
 
DSA chapter 1
DSA chapter 1DSA chapter 1
DSA chapter 1
 
Data Structures
Data StructuresData Structures
Data Structures
 
DATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGEDATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGE
 
Data structure & algorithms introduction
Data structure & algorithms introductionData structure & algorithms introduction
Data structure & algorithms introduction
 
STACK.pptx
STACK.pptxSTACK.pptx
STACK.pptx
 
Revised Data Structure- STACK in Python XII CS.pdf
Revised Data Structure- STACK in Python XII CS.pdfRevised Data Structure- STACK in Python XII CS.pdf
Revised Data Structure- STACK in Python XII CS.pdf
 
DS_PPT.ppt
DS_PPT.pptDS_PPT.ppt
DS_PPT.ppt
 
Unit 1.ppt
Unit 1.pptUnit 1.ppt
Unit 1.ppt
 
Dsa unit 1
Dsa unit 1Dsa unit 1
Dsa unit 1
 
C++ Data Structure PPT.ppt
C++ Data Structure PPT.pptC++ Data Structure PPT.ppt
C++ Data Structure PPT.ppt
 
DS_PPT.pptx
DS_PPT.pptxDS_PPT.pptx
DS_PPT.pptx
 
Data struchers and algorithms
Data struchers and algorithmsData struchers and algorithms
Data struchers and algorithms
 
DSA - Copy.pptx
DSA - Copy.pptxDSA - Copy.pptx
DSA - Copy.pptx
 
Unit.1 Introduction to Data Structuresres
Unit.1 Introduction to Data StructuresresUnit.1 Introduction to Data Structuresres
Unit.1 Introduction to Data Structuresres
 

Último

Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 

Último (20)

2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 

Introduction to stack

  • 2. STACK • Stack is a, Last in First Out or First in Last out, Linear, Non-primitive, Data +Structure. What exactly these points are, lets elaborate one by one in bottom up approach
  • 3. Data Structure: is a specialized format for organizing and storing the data in memory and accessing the data from the memory Classification of Data Structure Definition of Data Structure also defined as, process of storing and accessing the stored data from the memory in very efficient manner, efficiency in the matter of space and time
  • 4. Primitive Data Structure: -data structures that are directly operated upon the machine-level instructions -i.e., data structure which supports the basic data types such as: int, float, char, pointers, constants. Non-primitive Data Structure: - Data structures are derived from the primitive data structures -Structuring the group of homogeneous (same data type) or heterogeneous(different data type) Examples: Arrays, List, Files Non-Primitive classified into 2 types: 1.Linear: data structure which support homogeneous data elements. data elements are stored in the memory sequentially in other words there is adjacency link between the data elements examples: Stack, Queue, Linked list 2.Non-Linear: data items are connected to several other items. relationship between the data elements are in the fashion of parent-child examples: Graph, Tree
  • 5. Stack is linear data structure which follows a particular order in which the operations are performed. EXAMPLES: •STACK OF BOOKS ON DESK •STACK OF PLATES IN A CAFETERIA •STCAK OF COINS,CHAIRS,ETC..,
  • 6. OPERATIONS ON STACK •PUSH(): Place a new element into the stack. The value provided becomes the new topmost item in the stack •POP(): Remove the topmost item from the stack.
  • 7. PUSH() ALGORITHM TO PUSH AN ELEMENT ONTO STACK PUSH(S,TOP,SIZE,ITEM) 1.IF TOP == MAX THEN write(‘stack is full or overflow’) and exit 2. TOP=TOP+1 3. S[TOP]=ITEM 4. EXIT
  • 8. POP() ALGORITHM TO POP AN ELEMENT ONTO STACK POP(S,TOP,SIZE) 1.IF TOP == -1 THEN write(‘stack is EMPTY or UNDERFLOW’) and exit 2. VALUE=S[TOP] 3. TOP=TOP-1 4. EXIT
  • 9. APPLICATIONS OF STACK •Back and Forward Buttons in a Web Browser •Undo and Redo button of MS-word •Evaluating Arithmetic operations •Recursion