SlideShare a Scribd company logo
5
Most read
11
Most read
12
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

PPT
Queue Data Structure
PPTX
PPSX
Data Structure (Queue)
PPTX
Application of Stack For Expression Evaluation by Prakash Zodge DSY 41.pptx
PPTX
Sorting algorithms
PPTX
Linear data structure concepts
PPT
PDF
Queue as data_structure
Queue Data Structure
Data Structure (Queue)
Application of Stack For Expression Evaluation by Prakash Zodge DSY 41.pptx
Sorting algorithms
Linear data structure concepts
Queue as data_structure

What's hot (20)

PPT
Data Structure and Algorithms Linked List
PPTX
My lectures circular queue
PPSX
Data Structure (Stack)
PPTX
Stack and Queue
PPTX
heap Sort Algorithm
PPTX
Queue
PPTX
Priority queue in DSA
PPT
Linked List
PPTX
Quick sort
PPTX
Unit 2 linked list
PDF
All pairs shortest path algorithm
PPTX
Queue in Data Structure
PDF
file handling c++
PPTX
Presentation on queue
PPT
Queue in Data Structure
PPTX
Hash table in data structure and algorithm
PPTX
stack & queue
PPTX
Linked List - Insertion & Deletion
PPTX
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
Data Structure and Algorithms Linked List
My lectures circular queue
Data Structure (Stack)
Stack and Queue
heap Sort Algorithm
Queue
Priority queue in DSA
Linked List
Quick sort
Unit 2 linked list
All pairs shortest path algorithm
Queue in Data Structure
file handling c++
Presentation on queue
Queue in Data Structure
Hash table in data structure and algorithm
stack & queue
Linked List - Insertion & Deletion
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
Ad

Similar to Queue (20)

PDF
Lesson 4 - Queue ADT.pdf
PDF
Data Structures and Algorithm - Week 3 - Stacks and Queues
PPTX
Queues
PPT
Data Structures
PPTX
@Chapter 4 DSA Part II.pptx
PPTX
UNIT-2.pptx
PDF
Queue ADT for data structure for computer
PPT
Queue AS an ADT (Abstract Data Type)
PPTX
Queue Data Structure with detailed explanation
PDF
Lab 07 (2).pdfbdvdyve dhdysbsnjsnsvdvydbdns
PPTX
Queue ppt
PPTX
Queue collection of Frame work in oops through java
PPTX
Queue types of queue and algorithms and queue
PPTX
QUEUE in data-structure (classification, working procedure, Applications)
PPTX
Basic Queue Operation in DataStructure.pptx
PPTX
Fundamentals of Data Structure and Queues
PPTX
stacks and queues for public
PPTX
Understanding the Concepts and Applications of Stack and Queue
PPTX
DS10-QUEUE0000000000000000000000000000000000000.pptx
Lesson 4 - Queue ADT.pdf
Data Structures and Algorithm - Week 3 - Stacks and Queues
Queues
Data Structures
@Chapter 4 DSA Part II.pptx
UNIT-2.pptx
Queue ADT for data structure for computer
Queue AS an ADT (Abstract Data Type)
Queue Data Structure with detailed explanation
Lab 07 (2).pdfbdvdyve dhdysbsnjsnsvdvydbdns
Queue ppt
Queue collection of Frame work in oops through java
Queue types of queue and algorithms and queue
QUEUE in data-structure (classification, working procedure, Applications)
Basic Queue Operation in DataStructure.pptx
Fundamentals of Data Structure and Queues
stacks and queues for public
Understanding the Concepts and Applications of Stack and Queue
DS10-QUEUE0000000000000000000000000000000000000.pptx
Ad

More from Budditha Hettige (20)

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

Recently uploaded (20)

PPTX
GDM (1) (1).pptx small presentation for students
PDF
Insiders guide to clinical Medicine.pdf
PDF
Computing-Curriculum for Schools in Ghana
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Institutional Correction lecture only . . .
PPTX
Pharma ospi slides which help in ospi learning
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Lesson notes of climatology university.
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
RMMM.pdf make it easy to upload and study
PDF
01-Introduction-to-Information-Management.pdf
PDF
Basic Mud Logging Guide for educational purpose
GDM (1) (1).pptx small presentation for students
Insiders guide to clinical Medicine.pdf
Computing-Curriculum for Schools in Ghana
Module 4: Burden of Disease Tutorial Slides S2 2025
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Pharmacology of Heart Failure /Pharmacotherapy of CHF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
FourierSeries-QuestionsWithAnswers(Part-A).pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Institutional Correction lecture only . . .
Pharma ospi slides which help in ospi learning
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
STATICS OF THE RIGID BODIES Hibbelers.pdf
Microbial disease of the cardiovascular and lymphatic systems
Lesson notes of climatology university.
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
RMMM.pdf make it easy to upload and study
01-Introduction-to-Information-Management.pdf
Basic Mud Logging Guide for educational purpose

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