SlideShare a Scribd company logo
Stack & Queue
A computer often need to perform a particular 
subtask using the familiar subroutine structure. 
In order to maintain information and linkage 
between main program and subroutine, a data 
structure called stack is used.
Subroutine
STACK 
 A stack is a list of data elements, usually 
words or bytes, with accessing restriction 
that elements can be added (or) removed at 
one end of the list is called top of the stack. 
Other end is called bottom of the stack. 
The structure is sometimes referred to as a 
pushdown stack.
Example 
Image processing 
Pattern retrieval 
Parallel processing
Another descriptive 
LIFO-the last data placed on the stack is the 
first one removed when retrieval begins. 
Push & Pop- used to placing a new item on 
the stack and removing the top item from the 
stack.
Assume data stored in stack 
First element is placed in location 
BOTTOM, when new elements are pushed 
onto the stack, they are store successive 
lower address locations. 
We use a stack that grows in the direction of 
decreasing memory addresses.
example 
Stack of word items in the memory of a 
computer. 
It contain numerical values, with 43 at the 
bottom and -28 at the top. 
SP- A processor register point the top of the 
stack. 
32 bit word length and byte addressable.
Push operation 
Subtract #4, SP 
Move NEWITEM, (SP) 
The subtract instruction subtracts the source operand 4 
from the destination operand contained in SP and place 
the result in SP. 
These two instructions move the word from location 
NEWITEM onto the top of the stack, by decrementing 
the stack pointer by 4 before the move.
POP operation 
 Move (SP), ITEM 
 Add #4,SP 
These two instruction move the top value 
from stack into location ITEM and then 
increment the stack pointer by 4, now SP 
point to the new top element.
Auto increment or decrement 
Move NEWITEM, -(SP) -Push operation 
Move (SP)+, ITEM - POP operation
concept 
When stack is used in a program, it is 
usually allocated a fixed amount of space in 
the memory. 
We must avoid push an item onto the stack 
when the stack has reached its max size. 
We also avoid pop an item when the stack 
off an empty stack. 
Which could result from a programming 
error.
example 
Stack runs from location – 2000(Bottom) 
And no further than location 1500 
Recall that SP is decremented by 4 before 
new data are stored on the stack. 
Hence, an initial value of 2004 means that 
the first item pushed onto the stack will be at 
location 2000.
Prevent push or pop on empty stack
Stack & queue
Stack & queue
Stack & queue

More Related Content

What's hot

Input Output Organization
Input Output OrganizationInput Output Organization
Input Output Organization
Kamal Acharya
 
Addressing Modes
Addressing ModesAddressing Modes
Addressing Modes
Mayank Garg
 
Types of Addressing modes- COA
Types of Addressing modes- COATypes of Addressing modes- COA
Types of Addressing modes- COA
Ruchi Maurya
 
General register organization (computer organization)
General register organization  (computer organization)General register organization  (computer organization)
General register organization (computer organization)
rishi ram khanal
 
Instruction format
Instruction formatInstruction format
Instruction format
Sanjeev Patel
 
INSTRUCTION LEVEL PARALLALISM
INSTRUCTION LEVEL PARALLALISMINSTRUCTION LEVEL PARALLALISM
INSTRUCTION LEVEL PARALLALISMKamran Ashraf
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
Mukta Garg
 
Data transfer and manipulation
Data transfer and manipulationData transfer and manipulation
Data transfer and manipulation
janani thirupathi
 
Types of Instruction Format
Types of Instruction FormatTypes of Instruction Format
Types of Instruction Format
Dhrumil Panchal
 
Computer architecture pipelining
Computer architecture pipeliningComputer architecture pipelining
Computer architecture pipelining
Mazin Alwaaly
 
Computer arithmetic
Computer arithmeticComputer arithmetic
Computer arithmetic
Balakrishna Chowdary
 
Register transfer language & its micro operations
Register transfer language & its micro operationsRegister transfer language & its micro operations
Register transfer language & its micro operations
Lakshya Sharma
 
CS304PC:Computer Organization and Architecture Session 8 Address Sequencing.pptx
CS304PC:Computer Organization and Architecture Session 8 Address Sequencing.pptxCS304PC:Computer Organization and Architecture Session 8 Address Sequencing.pptx
CS304PC:Computer Organization and Architecture Session 8 Address Sequencing.pptx
Asst.prof M.Gokilavani
 
Logical and shift micro operations
Logical and shift micro operationsLogical and shift micro operations
Logical and shift micro operations
Sanjeev Patel
 
Different types of Addressing.cao
Different types of Addressing.caoDifferent types of Addressing.cao
Different types of Addressing.cao
Umme habiba
 
Addressing modes (detailed data path)
Addressing modes (detailed data path)Addressing modes (detailed data path)
Addressing modes (detailed data path)Mahesh Kumar Attri
 
Data Structures- Part7 linked lists
Data Structures- Part7 linked listsData Structures- Part7 linked lists
Data Structures- Part7 linked lists
Abdullah Al-hazmy
 
Chapter 03 arithmetic for computers
Chapter 03   arithmetic for computersChapter 03   arithmetic for computers
Chapter 03 arithmetic for computersBảo Hoang
 
Programming the basic computer
Programming the basic computerProgramming the basic computer
Programming the basic computer
Kamal Acharya
 

What's hot (20)

Input Output Organization
Input Output OrganizationInput Output Organization
Input Output Organization
 
Addressing Modes
Addressing ModesAddressing Modes
Addressing Modes
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
Types of Addressing modes- COA
Types of Addressing modes- COATypes of Addressing modes- COA
Types of Addressing modes- COA
 
General register organization (computer organization)
General register organization  (computer organization)General register organization  (computer organization)
General register organization (computer organization)
 
Instruction format
Instruction formatInstruction format
Instruction format
 
INSTRUCTION LEVEL PARALLALISM
INSTRUCTION LEVEL PARALLALISMINSTRUCTION LEVEL PARALLALISM
INSTRUCTION LEVEL PARALLALISM
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
Data transfer and manipulation
Data transfer and manipulationData transfer and manipulation
Data transfer and manipulation
 
Types of Instruction Format
Types of Instruction FormatTypes of Instruction Format
Types of Instruction Format
 
Computer architecture pipelining
Computer architecture pipeliningComputer architecture pipelining
Computer architecture pipelining
 
Computer arithmetic
Computer arithmeticComputer arithmetic
Computer arithmetic
 
Register transfer language & its micro operations
Register transfer language & its micro operationsRegister transfer language & its micro operations
Register transfer language & its micro operations
 
CS304PC:Computer Organization and Architecture Session 8 Address Sequencing.pptx
CS304PC:Computer Organization and Architecture Session 8 Address Sequencing.pptxCS304PC:Computer Organization and Architecture Session 8 Address Sequencing.pptx
CS304PC:Computer Organization and Architecture Session 8 Address Sequencing.pptx
 
Logical and shift micro operations
Logical and shift micro operationsLogical and shift micro operations
Logical and shift micro operations
 
Different types of Addressing.cao
Different types of Addressing.caoDifferent types of Addressing.cao
Different types of Addressing.cao
 
Addressing modes (detailed data path)
Addressing modes (detailed data path)Addressing modes (detailed data path)
Addressing modes (detailed data path)
 
Data Structures- Part7 linked lists
Data Structures- Part7 linked listsData Structures- Part7 linked lists
Data Structures- Part7 linked lists
 
Chapter 03 arithmetic for computers
Chapter 03   arithmetic for computersChapter 03   arithmetic for computers
Chapter 03 arithmetic for computers
 
Programming the basic computer
Programming the basic computerProgramming the basic computer
Programming the basic computer
 

Viewers also liked

Queue and stacks
Queue and stacksQueue and stacks
Queue and stacksgrahamwell
 
STACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURESTACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURE
Archie Jamwal
 
Queue data structure
Queue data structureQueue data structure
Queue data structure
anooppjoseph
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
Zidny Nafan
 
Notes DATA STRUCTURE - queue
Notes DATA STRUCTURE - queueNotes DATA STRUCTURE - queue
Notes DATA STRUCTURE - queue
Farhanum Aziera
 
Stack & queues
Stack & queuesStack & queues
Stack & queues
pinakspatel
 
Stack and queue
Stack and queueStack and queue
Stack and queue
Shakila Mahjabin
 
stack & queue
stack & queuestack & queue
stack & queue
manju rani
 
Stacks & Queues By Ms. Niti Arora
Stacks & Queues By Ms. Niti AroraStacks & Queues By Ms. Niti Arora
Stacks & Queues By Ms. Niti Arora
kulachihansraj
 
Stack
StackStack
Stack and queue
Stack and queueStack and queue
Stack and queue
Katang Isip
 
Queue Data Structure (w/ php egs)
Queue Data Structure (w/ php egs)Queue Data Structure (w/ php egs)
Queue Data Structure (w/ php egs)
Roman Rodomansky
 
Queue
QueueQueue
Ppt presentation of queues
Ppt presentation of queuesPpt presentation of queues
Ppt presentation of queues
Buxoo Abdullah
 
Stacks Implementation and Examples
Stacks Implementation and ExamplesStacks Implementation and Examples
Stacks Implementation and Examplesgreatqadirgee4u
 
Queue as data_structure
Queue as data_structureQueue as data_structure
Queue as data_structure
eShikshak
 
Computer notes - Josephus Problem
Computer notes - Josephus ProblemComputer notes - Josephus Problem
Computer notes - Josephus Problem
ecomputernotes
 
comp.org Chapter 2
comp.org Chapter 2comp.org Chapter 2
comp.org Chapter 2Rajat Sharma
 
Queue
QueueQueue
Dsa circular queue
Dsa circular queueDsa circular queue
Dsa circular queue
zzzubair
 

Viewers also liked (20)

Queue and stacks
Queue and stacksQueue and stacks
Queue and stacks
 
STACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURESTACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURE
 
Queue data structure
Queue data structureQueue data structure
Queue data structure
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
Notes DATA STRUCTURE - queue
Notes DATA STRUCTURE - queueNotes DATA STRUCTURE - queue
Notes DATA STRUCTURE - queue
 
Stack & queues
Stack & queuesStack & queues
Stack & queues
 
Stack and queue
Stack and queueStack and queue
Stack and queue
 
stack & queue
stack & queuestack & queue
stack & queue
 
Stacks & Queues By Ms. Niti Arora
Stacks & Queues By Ms. Niti AroraStacks & Queues By Ms. Niti Arora
Stacks & Queues By Ms. Niti Arora
 
Stack
StackStack
Stack
 
Stack and queue
Stack and queueStack and queue
Stack and queue
 
Queue Data Structure (w/ php egs)
Queue Data Structure (w/ php egs)Queue Data Structure (w/ php egs)
Queue Data Structure (w/ php egs)
 
Queue
QueueQueue
Queue
 
Ppt presentation of queues
Ppt presentation of queuesPpt presentation of queues
Ppt presentation of queues
 
Stacks Implementation and Examples
Stacks Implementation and ExamplesStacks Implementation and Examples
Stacks Implementation and Examples
 
Queue as data_structure
Queue as data_structureQueue as data_structure
Queue as data_structure
 
Computer notes - Josephus Problem
Computer notes - Josephus ProblemComputer notes - Josephus Problem
Computer notes - Josephus Problem
 
comp.org Chapter 2
comp.org Chapter 2comp.org Chapter 2
comp.org Chapter 2
 
Queue
QueueQueue
Queue
 
Dsa circular queue
Dsa circular queueDsa circular queue
Dsa circular queue
 

Similar to Stack & queue

Stack data structure
Stack data structureStack data structure
Stack data structure
rogineojerio020496
 
Stack
StackStack
04 stacks
04 stacks04 stacks
04 stacks
Rajan Gautam
 
Stacks Data structure.pptx
Stacks Data structure.pptxStacks Data structure.pptx
Stacks Data structure.pptx
line24arts
 
Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
Vineeta Garg
 
Stacks-and-Queues.pdf
Stacks-and-Queues.pdfStacks-and-Queues.pdf
Stacks-and-Queues.pdf
TobyWtf
 
Stack and its operations
Stack and its operationsStack and its operations
Stack and its operations
V.V.Vanniaperumal College for Women
 
What is Stack? Application of Stack
What is Stack? Application of StackWhat is Stack? Application of Stack
What is Stack? Application of Stack
Shahzeb Amjad
 
Chapter 5-stack.pptx
Chapter 5-stack.pptxChapter 5-stack.pptx
Chapter 5-stack.pptx
Halid Assen
 
Difference between stack and queue
Difference between stack and queueDifference between stack and queue
Difference between stack and queue
Pulkitmodi1998
 
What is Stack, Its Operations, Queue, Circular Queue, Priority Queue
What is Stack, Its Operations, Queue, Circular Queue, Priority QueueWhat is Stack, Its Operations, Queue, Circular Queue, Priority Queue
What is Stack, Its Operations, Queue, Circular Queue, Priority Queue
Balwant Gorad
 
Data structure lecture7
Data structure lecture7Data structure lecture7
Data structure lecture7Kumar
 
Chapter 5 Stack and Queue.pdf
Chapter 5 Stack and Queue.pdfChapter 5 Stack and Queue.pdf
Chapter 5 Stack and Queue.pdf
GirT2
 
Stack and its operations, Queue and its operations
Stack and its operations, Queue and its operationsStack and its operations, Queue and its operations
Stack and its operations, Queue and its operations
poongothai11
 
Data structure Stack
Data structure StackData structure Stack
Data structure Stack
Praveen Vishwakarma
 
DS UNIT 1.pdf
DS UNIT 1.pdfDS UNIT 1.pdf
DS UNIT 1.pdf
SeethaDinesh
 
DS UNIT 1.pdf
DS UNIT 1.pdfDS UNIT 1.pdf
DS UNIT 1.pdf
SeethaDinesh
 
Data structure stack&queue basics
Data structure stack&queue   basicsData structure stack&queue   basics
Data structure stack&queue basics
Selvin Josy Bai Somu
 
Stack and Queue
Stack and Queue Stack and Queue
Stack and Queue
Apurbo Datta
 

Similar to Stack & queue (20)

Stack data structure
Stack data structureStack data structure
Stack data structure
 
Stack
StackStack
Stack
 
04 stacks
04 stacks04 stacks
04 stacks
 
Stacks Data structure.pptx
Stacks Data structure.pptxStacks Data structure.pptx
Stacks Data structure.pptx
 
Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
 
Stacks-and-Queues.pdf
Stacks-and-Queues.pdfStacks-and-Queues.pdf
Stacks-and-Queues.pdf
 
Stack and its operations
Stack and its operationsStack and its operations
Stack and its operations
 
What is Stack? Application of Stack
What is Stack? Application of StackWhat is Stack? Application of Stack
What is Stack? Application of Stack
 
Chapter 5-stack.pptx
Chapter 5-stack.pptxChapter 5-stack.pptx
Chapter 5-stack.pptx
 
Difference between stack and queue
Difference between stack and queueDifference between stack and queue
Difference between stack and queue
 
What is Stack, Its Operations, Queue, Circular Queue, Priority Queue
What is Stack, Its Operations, Queue, Circular Queue, Priority QueueWhat is Stack, Its Operations, Queue, Circular Queue, Priority Queue
What is Stack, Its Operations, Queue, Circular Queue, Priority Queue
 
Data structure lecture7
Data structure lecture7Data structure lecture7
Data structure lecture7
 
Chapter 5 Stack and Queue.pdf
Chapter 5 Stack and Queue.pdfChapter 5 Stack and Queue.pdf
Chapter 5 Stack and Queue.pdf
 
Data structure by Digvijay
Data structure by DigvijayData structure by Digvijay
Data structure by Digvijay
 
Stack and its operations, Queue and its operations
Stack and its operations, Queue and its operationsStack and its operations, Queue and its operations
Stack and its operations, Queue and its operations
 
Data structure Stack
Data structure StackData structure Stack
Data structure Stack
 
DS UNIT 1.pdf
DS UNIT 1.pdfDS UNIT 1.pdf
DS UNIT 1.pdf
 
DS UNIT 1.pdf
DS UNIT 1.pdfDS UNIT 1.pdf
DS UNIT 1.pdf
 
Data structure stack&queue basics
Data structure stack&queue   basicsData structure stack&queue   basics
Data structure stack&queue basics
 
Stack and Queue
Stack and Queue Stack and Queue
Stack and Queue
 

More from Siddique Ibrahim

List in Python
List in PythonList in Python
List in Python
Siddique Ibrahim
 
Python Control structures
Python Control structuresPython Control structures
Python Control structures
Siddique Ibrahim
 
Python programming introduction
Python programming introductionPython programming introduction
Python programming introduction
Siddique Ibrahim
 
Data mining basic fundamentals
Data mining basic fundamentalsData mining basic fundamentals
Data mining basic fundamentals
Siddique Ibrahim
 
Basic networking
Basic networkingBasic networking
Basic networking
Siddique Ibrahim
 
Virtualization Concepts
Virtualization ConceptsVirtualization Concepts
Virtualization Concepts
Siddique Ibrahim
 
Networking devices(siddique)
Networking devices(siddique)Networking devices(siddique)
Networking devices(siddique)
Siddique Ibrahim
 
Osi model 7 Layers
Osi model 7 LayersOsi model 7 Layers
Osi model 7 Layers
Siddique Ibrahim
 
Mysql grand
Mysql grandMysql grand
Mysql grand
Siddique Ibrahim
 
Getting started into mySQL
Getting started into mySQLGetting started into mySQL
Getting started into mySQL
Siddique Ibrahim
 
pipelining
pipeliningpipelining
pipelining
Siddique Ibrahim
 
Micro programmed control
Micro programmed controlMicro programmed control
Micro programmed control
Siddique Ibrahim
 
Hardwired control
Hardwired controlHardwired control
Hardwired control
Siddique Ibrahim
 
interface
interfaceinterface
interface
Siddique Ibrahim
 
Interrupt
InterruptInterrupt
Interrupt
Siddique Ibrahim
 
Interrupt
InterruptInterrupt
Interrupt
Siddique Ibrahim
 
DMA
DMADMA
Io devies
Io deviesIo devies
Io devies
Siddique Ibrahim
 
Metadata in data warehouse
Metadata in data warehouseMetadata in data warehouse
Metadata in data warehouse
Siddique Ibrahim
 
Data extraction, transformation, and loading
Data extraction, transformation, and loadingData extraction, transformation, and loading
Data extraction, transformation, and loading
Siddique Ibrahim
 

More from Siddique Ibrahim (20)

List in Python
List in PythonList in Python
List in Python
 
Python Control structures
Python Control structuresPython Control structures
Python Control structures
 
Python programming introduction
Python programming introductionPython programming introduction
Python programming introduction
 
Data mining basic fundamentals
Data mining basic fundamentalsData mining basic fundamentals
Data mining basic fundamentals
 
Basic networking
Basic networkingBasic networking
Basic networking
 
Virtualization Concepts
Virtualization ConceptsVirtualization Concepts
Virtualization Concepts
 
Networking devices(siddique)
Networking devices(siddique)Networking devices(siddique)
Networking devices(siddique)
 
Osi model 7 Layers
Osi model 7 LayersOsi model 7 Layers
Osi model 7 Layers
 
Mysql grand
Mysql grandMysql grand
Mysql grand
 
Getting started into mySQL
Getting started into mySQLGetting started into mySQL
Getting started into mySQL
 
pipelining
pipeliningpipelining
pipelining
 
Micro programmed control
Micro programmed controlMicro programmed control
Micro programmed control
 
Hardwired control
Hardwired controlHardwired control
Hardwired control
 
interface
interfaceinterface
interface
 
Interrupt
InterruptInterrupt
Interrupt
 
Interrupt
InterruptInterrupt
Interrupt
 
DMA
DMADMA
DMA
 
Io devies
Io deviesIo devies
Io devies
 
Metadata in data warehouse
Metadata in data warehouseMetadata in data warehouse
Metadata in data warehouse
 
Data extraction, transformation, and loading
Data extraction, transformation, and loadingData extraction, transformation, and loading
Data extraction, transformation, and loading
 

Recently uploaded

"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
DhatriParmar
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 

Recently uploaded (20)

"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 

Stack & queue

  • 2. A computer often need to perform a particular subtask using the familiar subroutine structure. In order to maintain information and linkage between main program and subroutine, a data structure called stack is used.
  • 4. STACK  A stack is a list of data elements, usually words or bytes, with accessing restriction that elements can be added (or) removed at one end of the list is called top of the stack. Other end is called bottom of the stack. The structure is sometimes referred to as a pushdown stack.
  • 5. Example Image processing Pattern retrieval Parallel processing
  • 6. Another descriptive LIFO-the last data placed on the stack is the first one removed when retrieval begins. Push & Pop- used to placing a new item on the stack and removing the top item from the stack.
  • 7. Assume data stored in stack First element is placed in location BOTTOM, when new elements are pushed onto the stack, they are store successive lower address locations. We use a stack that grows in the direction of decreasing memory addresses.
  • 8. example Stack of word items in the memory of a computer. It contain numerical values, with 43 at the bottom and -28 at the top. SP- A processor register point the top of the stack. 32 bit word length and byte addressable.
  • 9.
  • 10. Push operation Subtract #4, SP Move NEWITEM, (SP) The subtract instruction subtracts the source operand 4 from the destination operand contained in SP and place the result in SP. These two instructions move the word from location NEWITEM onto the top of the stack, by decrementing the stack pointer by 4 before the move.
  • 11.
  • 12. POP operation  Move (SP), ITEM  Add #4,SP These two instruction move the top value from stack into location ITEM and then increment the stack pointer by 4, now SP point to the new top element.
  • 13. Auto increment or decrement Move NEWITEM, -(SP) -Push operation Move (SP)+, ITEM - POP operation
  • 14. concept When stack is used in a program, it is usually allocated a fixed amount of space in the memory. We must avoid push an item onto the stack when the stack has reached its max size. We also avoid pop an item when the stack off an empty stack. Which could result from a programming error.
  • 15. example Stack runs from location – 2000(Bottom) And no further than location 1500 Recall that SP is decremented by 4 before new data are stored on the stack. Hence, an initial value of 2004 means that the first item pushed onto the stack will be at location 2000.
  • 16. Prevent push or pop on empty stack