SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Department of IT

Presented by-
 Narendra katariya
The stack is a very common and non
   primitive data structure used in
programs. By data structure, I mean
something that is meant to hold data
 and provides certain operations on
              that data.
Abstract definition
• A stack is a fundamental computer
  science data structure and can be defined
  in an abstract, implementation-free
  manner,
• it can be generally defined as,
  Stack is a linear list of items in which all
  additions and deletion are restricted to
  one end that is Top.
Examples of stack
Operations on stack
• a stack is a last in, first out (LIFO) abstract data
  type and Data structure
  In computer science, a data structure is a particular
  way of storing and organizing data in a computer
  so that it can be used efficiently .Different kinds of
  data structures are suited to different kinds of
  applications, and some are highly specialized to
  specific tasks...

   A stack can have any abstract data type as an
  element, but is characterized by only three
  fundamental operations: push, pop and stack top
The basic operations that can be performed
                    on stack:

• Push: The process of adding a new element of
  top of the stack is called push operation.
  Pushing an element In the stack invoke adding
  of element, as the new element will be inserted
  at the top after every push operation the top is
  incremented by one. In case the array is full and
  no new element can be accommodated ,it is
  called stack full condition . This condition is
  called stack overflow.
Pop: the process of deleting an element from the
  Top of the stack is called pop operation. After
  every pop operation the stack is decrement by
  one. If there is no element on the stack and the
  pop is performed then this will result into stack
  underflow condition.
• A common model of a stack is plates in a
  marriage party or coin stacker. Fresh plate are
  “pushed” onto to the top and “popped ” from the
  top.
Stack implementation

                 Stacks


 static array                  dynamic arrays
                          Graphical region
Parenthesis
                          fill
checker
Stack implementation in two way:
• Static implementation: these implementation uses
  arrays to create stack. Static implementation
  though a very simple technique but is not a
  flexible way of creation as the size of stack has
  to be declared during program design after that
  can not be varied. Static implementation is not
  too efficient with respect to memory utilization.
• Dynamic implementation: these implementation is
  also called link list implementation and uses
  pointer to implement the stack type of data
  structure.
Stack Applications
• A Palindrome is a string that reads the same
  in either direction
  – Examples: “Able was I ere I saw Elba”
• Reversing the string
• Implementation of DFS
 - a stack is the proper data structure to
   remember the current node and how to
   backtrack.
Calculation of arithmetic notation

• Infix notation: the infix notetion is what we come
  across our general mathematics, where the
  opereter is written in between the operand.
Example: A+B
• prefix notation: the prefix notation a notation in which
  the operators is written before the operand, it is also
  called polish notation.
Example: +AB
• Postfix notation: in the postfix notation the operators
  are written after the operands, so it’s called the postfix
  notation’ it’s also called suffix notation.
Example :AB+
Thank you

Weitere ähnliche Inhalte

Was ist angesagt?

queue & its applications
queue & its applicationsqueue & its applications
queue & its applicationssomendra kumar
 
Introduction to stack
Introduction to stackIntroduction to stack
Introduction to stackvaibhav2910
 
Stack data structure
Stack data structureStack data structure
Stack data structureTech_MX
 
Ppt on Linked list,stack,queue
Ppt on Linked list,stack,queuePpt on Linked list,stack,queue
Ppt on Linked list,stack,queueSrajan Shukla
 
Data Structures - Lecture 7 [Linked List]
Data Structures - Lecture 7 [Linked List]Data Structures - Lecture 7 [Linked List]
Data Structures - Lecture 7 [Linked List]Muhammad Hammad Waseem
 
Queue - Data Structure - Notes
Queue - Data Structure - NotesQueue - Data Structure - Notes
Queue - Data Structure - NotesOmprakash Chauhan
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data StructureZidny Nafan
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure shameen khan
 
Stacks overview with its applications
Stacks overview with its applicationsStacks overview with its applications
Stacks overview with its applicationsSaqib Saeed
 
linked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutoriallinked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy TutorialAfzal Badshah
 
Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked ListNinad Mankar
 
Stack and its Applications : Data Structures ADT
Stack and its Applications : Data Structures ADTStack and its Applications : Data Structures ADT
Stack and its Applications : Data Structures ADTSoumen Santra
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data StructureMeghaj Mallick
 
Lec 17 heap data structure
Lec 17 heap data structureLec 17 heap data structure
Lec 17 heap data structureSajid Marwat
 

Was ist angesagt? (20)

queue & its applications
queue & its applicationsqueue & its applications
queue & its applications
 
Introduction to stack
Introduction to stackIntroduction to stack
Introduction to stack
 
Stack data structure
Stack data structureStack data structure
Stack data structure
 
Ppt on Linked list,stack,queue
Ppt on Linked list,stack,queuePpt on Linked list,stack,queue
Ppt on Linked list,stack,queue
 
Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
 
Data Structures - Lecture 7 [Linked List]
Data Structures - Lecture 7 [Linked List]Data Structures - Lecture 7 [Linked List]
Data Structures - Lecture 7 [Linked List]
 
Stack
StackStack
Stack
 
Queue - Data Structure - Notes
Queue - Data Structure - NotesQueue - Data Structure - Notes
Queue - Data Structure - Notes
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
Stacks overview with its applications
Stacks overview with its applicationsStacks overview with its applications
Stacks overview with its applications
 
linked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutoriallinked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutorial
 
Linked lists
Linked listsLinked lists
Linked lists
 
Queue ppt
Queue pptQueue ppt
Queue ppt
 
Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked List
 
Stack and its Applications : Data Structures ADT
Stack and its Applications : Data Structures ADTStack and its Applications : Data Structures ADT
Stack and its Applications : Data Structures ADT
 
Data structure stack&queue basics
Data structure stack&queue   basicsData structure stack&queue   basics
Data structure stack&queue basics
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data Structure
 
Lec 17 heap data structure
Lec 17 heap data structureLec 17 heap data structure
Lec 17 heap data structure
 
Stack
StackStack
Stack
 

Andere mochten auch

Andere mochten auch (20)

STACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURESTACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURE
 
Stack Applications
Stack ApplicationsStack Applications
Stack Applications
 
Stack Data Structure & It's Application
Stack Data Structure & It's Application Stack Data Structure & It's Application
Stack Data Structure & It's Application
 
Stacks Implementation and Examples
Stacks Implementation and ExamplesStacks Implementation and Examples
Stacks Implementation and Examples
 
Queue data structure
Queue data structureQueue data structure
Queue data structure
 
Applications of stack
Applications of stackApplications of stack
Applications of stack
 
Data structure Stack
Data structure StackData structure Stack
Data structure Stack
 
Stack Data Structure V1.0
Stack Data Structure V1.0Stack Data Structure V1.0
Stack Data Structure V1.0
 
Data Structure (Stack)
Data Structure (Stack)Data Structure (Stack)
Data Structure (Stack)
 
Application of Stacks
Application of StacksApplication of Stacks
Application of Stacks
 
Stacks & Queues By Ms. Niti Arora
Stacks & Queues By Ms. Niti AroraStacks & Queues By Ms. Niti Arora
Stacks & Queues By Ms. Niti Arora
 
Stack Data structure
Stack Data structureStack Data structure
Stack Data structure
 
Ppt presentation of queues
Ppt presentation of queuesPpt presentation of queues
Ppt presentation of queues
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURES
 
Trees data structure
Trees data structureTrees data structure
Trees data structure
 
Queue and stacks
Queue and stacksQueue and stacks
Queue and stacks
 
Queue
QueueQueue
Queue
 
Tree in data structure
Tree in data structureTree in data structure
Tree in data structure
 
Tree and binary tree
Tree and binary treeTree and binary tree
Tree and binary tree
 
Queue as data_structure
Queue as data_structureQueue as data_structure
Queue as data_structure
 

Ähnlich wie Stack a Data Structure (20)

STACK.pptx
STACK.pptxSTACK.pptx
STACK.pptx
 
stack.pptx
stack.pptxstack.pptx
stack.pptx
 
Stack in Sata Structure
Stack in Sata StructureStack in Sata Structure
Stack in Sata Structure
 
DSA_Lecture4-Stack.pptx
DSA_Lecture4-Stack.pptxDSA_Lecture4-Stack.pptx
DSA_Lecture4-Stack.pptx
 
5.-Stacks.pptx
5.-Stacks.pptx5.-Stacks.pptx
5.-Stacks.pptx
 
Stacks
StacksStacks
Stacks
 
Ds stack & queue
Ds   stack & queueDs   stack & queue
Ds stack & queue
 
Stack and Queue by M.Gomathi Lecturer
Stack and Queue by M.Gomathi LecturerStack and Queue by M.Gomathi Lecturer
Stack and Queue by M.Gomathi Lecturer
 
Unit 3 Stacks and Queues.pptx
Unit 3 Stacks and Queues.pptxUnit 3 Stacks and Queues.pptx
Unit 3 Stacks and Queues.pptx
 
2.1 STACK & QUEUE ADTS
2.1 STACK & QUEUE ADTS2.1 STACK & QUEUE ADTS
2.1 STACK & QUEUE ADTS
 
Data structure
Data structureData structure
Data structure
 
Data Structures
Data StructuresData Structures
Data Structures
 
Javascript stack
Javascript   stackJavascript   stack
Javascript stack
 
Data Structure - Stacks
Data Structure - StacksData Structure - Stacks
Data Structure - Stacks
 
STACKS AND QUEUES.pptx
STACKS AND QUEUES.pptxSTACKS AND QUEUES.pptx
STACKS AND QUEUES.pptx
 
STACKS AND QUEUES.pptx
STACKS AND QUEUES.pptxSTACKS AND QUEUES.pptx
STACKS AND QUEUES.pptx
 
CD3291 2.5 stack.pptx
CD3291 2.5 stack.pptxCD3291 2.5 stack.pptx
CD3291 2.5 stack.pptx
 
Difference between stack and queue
Difference between stack and queueDifference between stack and queue
Difference between stack and queue
 
Data structure.pdf
Data structure.pdfData structure.pdf
Data structure.pdf
 
Stacks
StacksStacks
Stacks
 

Mehr von ForwardBlog Enewzletter (10)

Sorting searching
Sorting searchingSorting searching
Sorting searching
 
Pn junction
Pn junctionPn junction
Pn junction
 
Feedback amplifiers
Feedback amplifiersFeedback amplifiers
Feedback amplifiers
 
Oscillators
OscillatorsOscillators
Oscillators
 
Compile time polymorphism
Compile time polymorphismCompile time polymorphism
Compile time polymorphism
 
Constructors & destructors
Constructors & destructorsConstructors & destructors
Constructors & destructors
 
Oo ps
Oo psOo ps
Oo ps
 
Parameter passing to_functions_in_c
Parameter passing to_functions_in_cParameter passing to_functions_in_c
Parameter passing to_functions_in_c
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Presentation on graphs
Presentation on graphsPresentation on graphs
Presentation on graphs
 

Kürzlich hochgeladen

Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxAmita Gupta
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxdhanalakshmis0310
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 

Kürzlich hochgeladen (20)

Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 

Stack a Data Structure

  • 1. Department of IT Presented by- Narendra katariya
  • 2. The stack is a very common and non primitive data structure used in programs. By data structure, I mean something that is meant to hold data and provides certain operations on that data.
  • 3. Abstract definition • A stack is a fundamental computer science data structure and can be defined in an abstract, implementation-free manner, • it can be generally defined as, Stack is a linear list of items in which all additions and deletion are restricted to one end that is Top.
  • 5. Operations on stack • a stack is a last in, first out (LIFO) abstract data type and Data structure In computer science, a data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently .Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks... A stack can have any abstract data type as an element, but is characterized by only three fundamental operations: push, pop and stack top
  • 6. The basic operations that can be performed on stack: • Push: The process of adding a new element of top of the stack is called push operation. Pushing an element In the stack invoke adding of element, as the new element will be inserted at the top after every push operation the top is incremented by one. In case the array is full and no new element can be accommodated ,it is called stack full condition . This condition is called stack overflow.
  • 7. Pop: the process of deleting an element from the Top of the stack is called pop operation. After every pop operation the stack is decrement by one. If there is no element on the stack and the pop is performed then this will result into stack underflow condition.
  • 8. • A common model of a stack is plates in a marriage party or coin stacker. Fresh plate are “pushed” onto to the top and “popped ” from the top.
  • 9. Stack implementation Stacks static array dynamic arrays Graphical region Parenthesis fill checker
  • 10. Stack implementation in two way: • Static implementation: these implementation uses arrays to create stack. Static implementation though a very simple technique but is not a flexible way of creation as the size of stack has to be declared during program design after that can not be varied. Static implementation is not too efficient with respect to memory utilization. • Dynamic implementation: these implementation is also called link list implementation and uses pointer to implement the stack type of data structure.
  • 11. Stack Applications • A Palindrome is a string that reads the same in either direction – Examples: “Able was I ere I saw Elba” • Reversing the string • Implementation of DFS - a stack is the proper data structure to remember the current node and how to backtrack.
  • 12. Calculation of arithmetic notation • Infix notation: the infix notetion is what we come across our general mathematics, where the opereter is written in between the operand. Example: A+B • prefix notation: the prefix notation a notation in which the operators is written before the operand, it is also called polish notation. Example: +AB • Postfix notation: in the postfix notation the operators are written after the operands, so it’s called the postfix notation’ it’s also called suffix notation. Example :AB+