SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

Data structure and its types
Data structure and its typesData structure and its types
Data structure and its types
Navtar Sidhu Brar
 

Tendances (20)

Data Structure (Queue)
Data Structure (Queue)Data Structure (Queue)
Data Structure (Queue)
 
Queue AS an ADT (Abstract Data Type)
Queue AS an ADT (Abstract Data Type)Queue AS an ADT (Abstract Data Type)
Queue AS an ADT (Abstract Data Type)
 
Data structure by Digvijay
Data structure by DigvijayData structure by Digvijay
Data structure by Digvijay
 
Stacks
StacksStacks
Stacks
 
Stack
StackStack
Stack
 
Stack
StackStack
Stack
 
Stack
StackStack
Stack
 
stack & queue
stack & queuestack & queue
stack & queue
 
stack presentation
stack presentationstack presentation
stack presentation
 
linked lists in data structures
linked lists in data structureslinked lists in data structures
linked lists in data structures
 
Queues
QueuesQueues
Queues
 
Data structure and its types
Data structure and its typesData structure and its types
Data structure and its types
 
Linked list
Linked listLinked list
Linked list
 
Stacks
StacksStacks
Stacks
 
STACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURESTACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURE
 
Stack and Queue
Stack and Queue Stack and Queue
Stack and Queue
 
Project of data structure
Project of data structureProject of data structure
Project of data structure
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 Data Structures - Lecture 9 [Stack & Queue using Linked List] Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 
Stacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURESStacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURES
 
Queues in C++
Queues in C++Queues in C++
Queues in C++
 

En vedette

Stack data structure
Stack data structureStack data structure
Stack data structure
Tech_MX
 
Stack Data Structure & It's Application
Stack Data Structure & It's Application Stack Data Structure & It's Application
Stack Data Structure & It's Application
Tech_MX
 
Stacks Implementation and Examples
Stacks Implementation and ExamplesStacks Implementation and Examples
Stacks Implementation and Examples
greatqadirgee4u
 
Queue and stacks
Queue and stacksQueue and stacks
Queue and stacks
grahamwell
 
Tree in data structure
Tree in data structureTree in data structure
Tree in data structure
ghhgj jhgh
 
Data structures (introduction)
 Data structures (introduction) Data structures (introduction)
Data structures (introduction)
Arvind Devaraj
 

En vedette (20)

Stack data structure
Stack data structureStack data structure
Stack data structure
 
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
 
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)
 

Similaire à Stack a Data Structure

Similaire à 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
 

Plus 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
 

Dernier

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
heathfieldcps1
 

Dernier (20)

How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
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
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
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
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 

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+