SlideShare a Scribd company logo
5
Most read
9
Most read
11
Most read
IT 4043
Data Structures and Algorithms
Budditha Hettige
Department of Computer Science
1
Queue
5
Course Outline
• Introduction to DSA
• Abstract Data Types (ADT)
• List operation using arrays
• Stacks
•Queues
• Recursion
• Link List
• Sorting
• Searching
• Algorithms Analysis
2
3
Objectives
• Examine queue processing
• Define a queue abstract data type
• Demonstrate how a queue can be used
to solve problems
4
4
Queue
• Queue: a collection whose elements are
added at one end (the rear or tail of the
queue) and removed from the other end
(the front or head of the queue)
• A queue is a FIFO (first in, first out) data
structure
• Any waiting line is a queue:
–The check-out line at a grocery store
–The cars at a stop light
–An assembly line
Conceptual View of a Queue
Front of queue
Rear of queue
5
Conceptual View of a Queue
Front of queue
Adding an element
The new element is
added to the rear of the
queue
5
Removing an element
New front element of queue
The element is removed
from the front of the
queue
Conceptual View of a Queue
6
9
Uses of Queues in Computing
• Printer queue
• Keyboard input buffer
• GUI event queue (click on buttons, menu items)
• To encode messages
• For any kind of problem involving FIFO data
10
Operations on a Queue
Operation Description
remove Removes an element from the front of the queue
insert Adds an element to the rear of the queue
isFull Determines whether the queue is full
isEmpty Determines whether the queue is empty
Implementation of a Queue
11
12
An Array Implementation of a Queue
13
An Array Implementation of a Queue
Before After
14
An Array Implementation of a Queue
15
An Array Implementation of a Queue
Summary
• Queue: a collection whose elements are
added at one end and removed from the
other end
• A queue is a FIFO (first in, first out) data
structure
• Queue Implementation (Java)
16
Questions
1. Specify 3 usages of Queues in Computing.
2. Identify which of the following is/are true? In
each case justify your answer.
a. Web browsers use queues to retrieve data
b. In the front fix array bases queue
implementation, remove operation is less
efficient than insert
17
Thank you!
18

More Related Content

What's hot (20)

PPT
Queue in Data Structure
Muhazzab Chouhadry
 
PPTX
BINARY SEARCH TREE
Usha Mahalingam
 
PPT
Unit 4 external sorting
DrkhanchanaR
 
PPTX
Applications of data structures
Wipro
 
PDF
Queue as data_structure
eShikshak
 
PDF
Dsa circular queue
zzzubair
 
PPTX
Stack Data Structure
Afaq Mansoor Khan
 
PPTX
Stack of Data structure
Sheikh Monirul Hasan
 
PPTX
Priority queue in DSA
junnubabu
 
PPTX
Introduction to data structure
NUPOORAWSARMOL
 
PPT
Lec 17 heap data structure
Sajid Marwat
 
PPTX
Circular Queue data structure
Dhananjaysinh Jhala
 
PPT
Heaps
Hafiz Atif Amin
 
PPTX
linked list in Data Structure, Simple and Easy Tutorial
Afzal Badshah
 
PPTX
My lectures circular queue
Senthil Kumar
 
PPTX
Queues in C++
Vineeta Garg
 
PPTX
Stack and queue
CHANDAN KUMAR
 
PPTX
queue & its applications
somendra kumar
 
PDF
Red black tree
Dr Sandeep Kumar Poonia
 
Queue in Data Structure
Muhazzab Chouhadry
 
BINARY SEARCH TREE
Usha Mahalingam
 
Unit 4 external sorting
DrkhanchanaR
 
Applications of data structures
Wipro
 
Queue as data_structure
eShikshak
 
Dsa circular queue
zzzubair
 
Stack Data Structure
Afaq Mansoor Khan
 
Stack of Data structure
Sheikh Monirul Hasan
 
Priority queue in DSA
junnubabu
 
Introduction to data structure
NUPOORAWSARMOL
 
Lec 17 heap data structure
Sajid Marwat
 
Circular Queue data structure
Dhananjaysinh Jhala
 
linked list in Data Structure, Simple and Easy Tutorial
Afzal Badshah
 
My lectures circular queue
Senthil Kumar
 
Queues in C++
Vineeta Garg
 
Stack and queue
CHANDAN KUMAR
 
queue & its applications
somendra kumar
 
Red black tree
Dr Sandeep Kumar Poonia
 

Similar to Queue (20)

PDF
Lesson 4 - Queue ADT.pdf
LeandroJrErcia
 
PDF
Data Structures and Algorithm - Week 3 - Stacks and Queues
Ferdin Joe John Joseph PhD
 
PPTX
Queues
nidhisatija1
 
PPT
Data Structures
Dr.Umadevi V
 
PPTX
@Chapter 4 DSA Part II.pptx
NuraMohamed9
 
PPTX
UNIT-2.pptx
ChiragSuresh
 
PDF
Queue ADT for data structure for computer
abinathsabi
 
PPT
Queue AS an ADT (Abstract Data Type)
Self-Employed
 
PPTX
Queue Data Structure with detailed explanation
shanmugapriyacsecs
 
PDF
Lab 07 (2).pdfbdvdyve dhdysbsnjsnsvdvydbdns
playstore9ha
 
PPTX
Queue ppt
SouravKumar328
 
PPTX
Queue collection of Frame work in oops through java
bhavanibhanu3456
 
PPTX
Queue types of queue and algorithms and queue
geethikasudineni
 
PPTX
QUEUE in data-structure (classification, working procedure, Applications)
Mehedi Hasan
 
PPTX
Basic Queue Operation in DataStructure.pptx
LakshmiSamivel
 
PPTX
Fundamentals of Data Structure and Queues
Bogiri Nagaraju
 
PPTX
stacks and queues for public
iqbalphy1
 
PPTX
Understanding the Concepts and Applications of Stack and Queue
madhuakash830
 
PPTX
DS10-QUEUE0000000000000000000000000000000000000.pptx
ProfVMGawde
 
Lesson 4 - Queue ADT.pdf
LeandroJrErcia
 
Data Structures and Algorithm - Week 3 - Stacks and Queues
Ferdin Joe John Joseph PhD
 
Queues
nidhisatija1
 
Data Structures
Dr.Umadevi V
 
@Chapter 4 DSA Part II.pptx
NuraMohamed9
 
UNIT-2.pptx
ChiragSuresh
 
Queue ADT for data structure for computer
abinathsabi
 
Queue AS an ADT (Abstract Data Type)
Self-Employed
 
Queue Data Structure with detailed explanation
shanmugapriyacsecs
 
Lab 07 (2).pdfbdvdyve dhdysbsnjsnsvdvydbdns
playstore9ha
 
Queue ppt
SouravKumar328
 
Queue collection of Frame work in oops through java
bhavanibhanu3456
 
Queue types of queue and algorithms and queue
geethikasudineni
 
QUEUE in data-structure (classification, working procedure, Applications)
Mehedi Hasan
 
Basic Queue Operation in DataStructure.pptx
LakshmiSamivel
 
Fundamentals of Data Structure and Queues
Bogiri Nagaraju
 
stacks and queues for public
iqbalphy1
 
Understanding the Concepts and Applications of Stack and Queue
madhuakash830
 
DS10-QUEUE0000000000000000000000000000000000000.pptx
ProfVMGawde
 
Ad

More from Budditha Hettige (20)

PDF
Algorithm analysis
Budditha Hettige
 
PDF
Sorting
Budditha Hettige
 
PDF
Link List
Budditha Hettige
 
PDF
02 Stack
Budditha Hettige
 
PDF
Data Structures 01
Budditha Hettige
 
PDF
Drawing Fonts
Budditha Hettige
 
PDF
Texture Mapping
Budditha Hettige
 
PDF
Lighting
Budditha Hettige
 
PDF
Viewing
Budditha Hettige
 
PDF
OpenGL 3D Drawing
Budditha Hettige
 
PDF
2D Drawing
Budditha Hettige
 
PDF
Graphics Programming OpenGL & GLUT in Code::Blocks
Budditha Hettige
 
PDF
Introduction to Computer Graphics
Budditha Hettige
 
PPTX
Computer System Architecture Lecture Note 9 IO fundamentals
Budditha Hettige
 
PPTX
Computer System Architecture Lecture Note 8.1 primary Memory
Budditha Hettige
 
PPTX
Computer System Architecture Lecture Note 8.2 Cache Memory
Budditha Hettige
 
PPTX
Computer System Architecture Lecture Note 7 addressing
Budditha Hettige
 
PPT
Computer System Architecture Lecture Note 6: hardware performance
Budditha Hettige
 
PPT
Computer System Architecture Lecture Note 5: microprocessor technology
Budditha Hettige
 
PPT
Computer System Architecture Lecture Note 3: computer architecture
Budditha Hettige
 
Algorithm analysis
Budditha Hettige
 
Link List
Budditha Hettige
 
Data Structures 01
Budditha Hettige
 
Drawing Fonts
Budditha Hettige
 
Texture Mapping
Budditha Hettige
 
OpenGL 3D Drawing
Budditha Hettige
 
2D Drawing
Budditha Hettige
 
Graphics Programming OpenGL & GLUT in Code::Blocks
Budditha Hettige
 
Introduction to Computer Graphics
Budditha Hettige
 
Computer System Architecture Lecture Note 9 IO fundamentals
Budditha Hettige
 
Computer System Architecture Lecture Note 8.1 primary Memory
Budditha Hettige
 
Computer System Architecture Lecture Note 8.2 Cache Memory
Budditha Hettige
 
Computer System Architecture Lecture Note 7 addressing
Budditha Hettige
 
Computer System Architecture Lecture Note 6: hardware performance
Budditha Hettige
 
Computer System Architecture Lecture Note 5: microprocessor technology
Budditha Hettige
 
Computer System Architecture Lecture Note 3: computer architecture
Budditha Hettige
 
Ad

Recently uploaded (20)

PPTX
K-Circle-Weekly-Quiz12121212-May2025.pptx
Pankaj Rodey
 
PPTX
Rules and Regulations of Madhya Pradesh Library Part-I
SantoshKumarKori2
 
PPTX
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
PPTX
I INCLUDED THIS TOPIC IS INTELLIGENCE DEFINITION, MEANING, INDIVIDUAL DIFFERE...
parmarjuli1412
 
PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
PPTX
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
PPTX
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
PPTX
Virus sequence retrieval from NCBI database
yamunaK13
 
DOCX
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
DOCX
pgdei-UNIT -V Neurological Disorders & developmental disabilities
JELLA VISHNU DURGA PRASAD
 
PPTX
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
PPTX
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
PPTX
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
PPTX
TOP 10 AI TOOLS YOU MUST LEARN TO SURVIVE IN 2025 AND ABOVE
digilearnings.com
 
PDF
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
DOCX
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
PPTX
Introduction to Probability(basic) .pptx
purohitanuj034
 
PPTX
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
PPTX
Applied-Statistics-1.pptx hardiba zalaaa
hardizala899
 
K-Circle-Weekly-Quiz12121212-May2025.pptx
Pankaj Rodey
 
Rules and Regulations of Madhya Pradesh Library Part-I
SantoshKumarKori2
 
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
I INCLUDED THIS TOPIC IS INTELLIGENCE DEFINITION, MEANING, INDIVIDUAL DIFFERE...
parmarjuli1412
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
Virus sequence retrieval from NCBI database
yamunaK13
 
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
pgdei-UNIT -V Neurological Disorders & developmental disabilities
JELLA VISHNU DURGA PRASAD
 
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
TOP 10 AI TOOLS YOU MUST LEARN TO SURVIVE IN 2025 AND ABOVE
digilearnings.com
 
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
Introduction to Probability(basic) .pptx
purohitanuj034
 
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
Applied-Statistics-1.pptx hardiba zalaaa
hardizala899
 

Queue

  • 1. IT 4043 Data Structures and Algorithms Budditha Hettige Department of Computer Science 1 Queue 5
  • 2. Course Outline • Introduction to DSA • Abstract Data Types (ADT) • List operation using arrays • Stacks •Queues • Recursion • Link List • Sorting • Searching • Algorithms Analysis 2
  • 3. 3 Objectives • Examine queue processing • Define a queue abstract data type • Demonstrate how a queue can be used to solve problems
  • 4. 4
  • 5. 4 Queue • Queue: a collection whose elements are added at one end (the rear or tail of the queue) and removed from the other end (the front or head of the queue) • A queue is a FIFO (first in, first out) data structure • Any waiting line is a queue: –The check-out line at a grocery store –The cars at a stop light –An assembly line
  • 6. Conceptual View of a Queue Front of queue Rear of queue 5
  • 7. Conceptual View of a Queue Front of queue Adding an element The new element is added to the rear of the queue 5
  • 8. Removing an element New front element of queue The element is removed from the front of the queue Conceptual View of a Queue 6
  • 9. 9 Uses of Queues in Computing • Printer queue • Keyboard input buffer • GUI event queue (click on buttons, menu items) • To encode messages • For any kind of problem involving FIFO data
  • 10. 10 Operations on a Queue Operation Description remove Removes an element from the front of the queue insert Adds an element to the rear of the queue isFull Determines whether the queue is full isEmpty Determines whether the queue is empty
  • 13. 13 An Array Implementation of a Queue Before After
  • 16. Summary • Queue: a collection whose elements are added at one end and removed from the other end • A queue is a FIFO (first in, first out) data structure • Queue Implementation (Java) 16
  • 17. Questions 1. Specify 3 usages of Queues in Computing. 2. Identify which of the following is/are true? In each case justify your answer. a. Web browsers use queues to retrieve data b. In the front fix array bases queue implementation, remove operation is less efficient than insert 17