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

More Related Content

What's hot

Introduction to stack
Introduction to stackIntroduction to stack
Introduction to stack
vaibhav2910
 
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
 
Stack data structure
Stack data structureStack data structure
Stack data structure
Tech_MX
 
My lectures circular queue
My lectures circular queueMy lectures circular queue
My lectures circular queue
Senthil Kumar
 
Stacks overview with its applications
Stacks overview with its applicationsStacks overview with its applications
Stacks overview with its applications
Saqib Saeed
 

What's hot (20)

SEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMSSEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMS
 
Data Structure (Queue)
Data Structure (Queue)Data Structure (Queue)
Data Structure (Queue)
 
Queue in Data Structure
Queue in Data Structure Queue in Data Structure
Queue in Data Structure
 
stack presentation
stack presentationstack presentation
stack presentation
 
Introduction to stack
Introduction to stackIntroduction to stack
Introduction to stack
 
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
 
Data Structure and Algorithms Binary Search Tree
Data Structure and Algorithms Binary Search TreeData Structure and Algorithms Binary Search Tree
Data Structure and Algorithms Binary Search Tree
 
Unit I - Evaluation of expression
Unit I - Evaluation of expressionUnit I - Evaluation of expression
Unit I - Evaluation of expression
 
Stack Data Structure & It's Application
Stack Data Structure & It's Application Stack Data Structure & It's Application
Stack Data Structure & It's Application
 
stack & queue
stack & queuestack & queue
stack & queue
 
Queue
QueueQueue
Queue
 
Stacks
StacksStacks
Stacks
 
Linked List
Linked ListLinked List
Linked List
 
Sorting
SortingSorting
Sorting
 
queue & its applications
queue & its applicationsqueue & its applications
queue & its applications
 
Stack data structure
Stack data structureStack data structure
Stack data structure
 
My lectures circular queue
My lectures circular queueMy lectures circular queue
My lectures circular queue
 
Stack project
Stack projectStack project
Stack project
 
Stacks overview with its applications
Stacks overview with its applicationsStacks overview with its applications
Stacks overview with its applications
 
Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm
 

Viewers also liked

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
 

Viewers also liked (20)

STACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURESTACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURE
 
Stack Applications
Stack ApplicationsStack Applications
Stack Applications
 
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
 
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
 
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)
 

Similar to Stack a Data Structure

Similar to 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
 
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
 
Stacks in Data Structure
Stacks in Data StructureStacks in Data Structure
Stacks in Data Structure
 

More from 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
 

Recently uploaded

會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
CaitlinCummins3
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptx
heathfieldcps1
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
Peter Brusilovsky
 

Recently uploaded (20)

demyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxdemyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptx
 
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
philosophy and it's principles based on the life
philosophy and it's principles based on the lifephilosophy and it's principles based on the life
philosophy and it's principles based on the life
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
How to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 InventoryHow to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 Inventory
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptx
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
 
“O BEIJO” EM ARTE .
“O BEIJO” EM ARTE                       .“O BEIJO” EM ARTE                       .
“O BEIJO” EM ARTE .
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 

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+