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

Más contenido relacionado

La actualidad más candente

Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data StructureZidny Nafan
 
queue & its applications
queue & its applicationsqueue & its applications
queue & its applicationssomendra kumar
 
Priority queue in DSA
Priority queue in DSAPriority queue in DSA
Priority queue in DSAjunnubabu
 
Stacks Implementation and Examples
Stacks Implementation and ExamplesStacks Implementation and Examples
Stacks Implementation and Examplesgreatqadirgee4u
 
Binary search in data structure
Binary search in data structureBinary search in data structure
Binary search in data structureMeherul1234
 
SEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMSSEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMSGokul Hari
 
Stack data structure
Stack data structureStack data structure
Stack data structureTech_MX
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure shameen khan
 
Infix to Postfix Conversion Using Stack
Infix to Postfix Conversion Using StackInfix to Postfix Conversion Using Stack
Infix to Postfix Conversion Using StackSoumen Santra
 
Deque and its applications
Deque and its applicationsDeque and its applications
Deque and its applicationsJsaddam Hussain
 
Linked List - Insertion & Deletion
Linked List - Insertion & DeletionLinked List - Insertion & Deletion
Linked List - Insertion & DeletionAfaq Mansoor Khan
 
heap Sort Algorithm
heap  Sort Algorithmheap  Sort Algorithm
heap Sort AlgorithmLemia Algmri
 

La actualidad más candente (20)

Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
Data structure by Digvijay
Data structure by DigvijayData structure by Digvijay
Data structure by Digvijay
 
Queues
QueuesQueues
Queues
 
queue & its applications
queue & its applicationsqueue & its applications
queue & its applications
 
Stack and Queue
Stack and Queue Stack and Queue
Stack and Queue
 
Circular Queue data structure
Circular Queue data structureCircular Queue data structure
Circular Queue data structure
 
Stack
StackStack
Stack
 
Priority queue in DSA
Priority queue in DSAPriority queue in DSA
Priority queue in DSA
 
Stacks Implementation and Examples
Stacks Implementation and ExamplesStacks Implementation and Examples
Stacks Implementation and Examples
 
Binary search in data structure
Binary search in data structureBinary search in data structure
Binary search in data structure
 
SEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMSSEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMS
 
Stack data structure
Stack data structureStack data structure
Stack data structure
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Linked list
Linked listLinked list
Linked list
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
Stack
StackStack
Stack
 
Infix to Postfix Conversion Using Stack
Infix to Postfix Conversion Using StackInfix to Postfix Conversion Using Stack
Infix to Postfix Conversion Using Stack
 
Deque and its applications
Deque and its applicationsDeque and its applications
Deque and its applications
 
Linked List - Insertion & Deletion
Linked List - Insertion & DeletionLinked List - Insertion & Deletion
Linked List - Insertion & Deletion
 
heap Sort Algorithm
heap  Sort Algorithmheap  Sort Algorithm
heap Sort Algorithm
 

Destacado (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
 
Queue data structure
Queue data structureQueue data structure
Queue data structure
 
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
 
Data structures (introduction)
 Data structures (introduction) Data structures (introduction)
Data structures (introduction)
 
Notes DATA STRUCTURE - queue
Notes DATA STRUCTURE - queueNotes DATA STRUCTURE - queue
Notes DATA STRUCTURE - queue
 

Similar a 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
 

Más de 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
 

Último

Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 

Último (20)

LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 

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+