SlideShare a Scribd company logo
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

More Related Content

What's hot

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
 

What's hot (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 to Introduction to stack

Stack and queue power point presentation data structure and algorithms Stack-...
Stack and queue power point presentation data structure and algorithms Stack-...Stack and queue power point presentation data structure and algorithms Stack-...
Stack and queue power point presentation data structure and algorithms Stack-...
abhaysingh19149
 

Similar to 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
 
Stack and queue power point presentation data structure and algorithms Stack-...
Stack and queue power point presentation data structure and algorithms Stack-...Stack and queue power point presentation data structure and algorithms Stack-...
Stack and queue power point presentation data structure and algorithms Stack-...
 
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
 

Recently uploaded

Laundry management system project report.pdf
Laundry management system project report.pdfLaundry management system project report.pdf
Laundry management system project report.pdf
Kamal Acharya
 
Fruit shop management system project report.pdf
Fruit shop management system project report.pdfFruit shop management system project report.pdf
Fruit shop management system project report.pdf
Kamal Acharya
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
Kamal Acharya
 

Recently uploaded (20)

ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
 
Laundry management system project report.pdf
Laundry management system project report.pdfLaundry management system project report.pdf
Laundry management system project report.pdf
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
Natalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in KrakówNatalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in Kraków
 
shape functions of 1D and 2 D rectangular elements.pptx
shape functions of 1D and 2 D rectangular elements.pptxshape functions of 1D and 2 D rectangular elements.pptx
shape functions of 1D and 2 D rectangular elements.pptx
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
İTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering WorkshopİTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering Workshop
 
Scaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltageScaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltage
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
Toll tax management system project report..pdf
Toll tax management system project report..pdfToll tax management system project report..pdf
Toll tax management system project report..pdf
 
Danfoss NeoCharge Technology -A Revolution in 2024.pdf
Danfoss NeoCharge Technology -A Revolution in 2024.pdfDanfoss NeoCharge Technology -A Revolution in 2024.pdf
Danfoss NeoCharge Technology -A Revolution in 2024.pdf
 
Fruit shop management system project report.pdf
Fruit shop management system project report.pdfFruit shop management system project report.pdf
Fruit shop management system project report.pdf
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
Top 13 Famous Civil Engineering Scientist
Top 13 Famous Civil Engineering ScientistTop 13 Famous Civil Engineering Scientist
Top 13 Famous Civil Engineering Scientist
 

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