SlideShare una empresa de 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

Más contenido relacionado

La actualidad más candente

Data structures and Alogarithims
Data structures and AlogarithimsData structures and Alogarithims
Data structures and AlogarithimsVictor Palmar
 
Introduction To Data Structures.
Introduction To Data Structures.Introduction To Data Structures.
Introduction To Data Structures.Education Front
 
Data structures Lecture no. 2
Data structures Lecture no. 2Data structures Lecture no. 2
Data structures Lecture no. 2AzharIqbal710687
 
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 Vinayak SofTech
 
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure pptNalinNishant3
 
Data structures Lecture no.3
Data structures Lecture no.3Data structures Lecture no.3
Data structures Lecture no.3AzharIqbal710687
 
Introduction of Data Structure
Introduction of Data StructureIntroduction of Data Structure
Introduction of Data StructureMandavi Classes
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structureadeel hamid
 
Data structure
Data structureData structure
Data structureMohd Arif
 
Introductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueIntroductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueGhaffar Khan
 
Data structures lectures no 1
Data structures lectures no 1Data structures lectures no 1
Data structures lectures no 1AzharIqbal710687
 
data structure
data structuredata structure
data structurehashim102
 
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]Muhammad Hammad Waseem
 
Data structure & its types
Data structure & its typesData structure & its types
Data structure & its typesRameesha Sadaqat
 

La actualidad más candente (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
 

Similar a Introduction to stack

Stack Data Structure
Stack Data StructureStack Data Structure
Stack Data StructureRabin BK
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptxSaralaT3
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptxsarala9
 
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.pptxmexiuro901
 
DATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGEDATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGEshubhamrohiwal6
 
Data structure & algorithms introduction
Data structure & algorithms introductionData structure & algorithms introduction
Data structure & algorithms introductionSugandh Wafai
 
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.pdfMohammadImran709594
 
C++ Data Structure PPT.ppt
C++ Data Structure PPT.pptC++ Data Structure PPT.ppt
C++ Data Structure PPT.pptMukesh Thakur
 
Data struchers and algorithms
Data struchers and algorithmsData struchers and algorithms
Data struchers and algorithmsjunnubabu
 
Unit.1 Introduction to Data Structuresres
Unit.1 Introduction to Data StructuresresUnit.1 Introduction to Data Structuresres
Unit.1 Introduction to Data Structuresresamplopsurat
 

Similar 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

Piping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringPiping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringJuanCarlosMorales19600
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
Transport layer issues and challenges - Guide
Transport layer issues and challenges - GuideTransport layer issues and challenges - Guide
Transport layer issues and challenges - GuideGOPINATHS437943
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgsaravananr517913
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 
Solving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptSolving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptJasonTagapanGulla
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm Systemirfanmechengr
 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the weldingMuhammadUzairLiaqat
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxsomshekarkn64
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 

Último (20)

Piping Basic stress analysis by engineering
Piping Basic stress analysis by engineeringPiping Basic stress analysis by engineering
Piping Basic stress analysis by engineering
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
Transport layer issues and challenges - Guide
Transport layer issues and challenges - GuideTransport layer issues and challenges - Guide
Transport layer issues and challenges - Guide
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 
Solving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptSolving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.ppt
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm System
 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the welding
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptx
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 

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