0% found this document useful (0 votes)
21 views16 pages

Queue

The document provides an overview of queues, a fundamental data structure that operates on a First In, First Out (FIFO) principle. It details various operations of queues, applications in computing such as job scheduling and event handling, and types of queues including linear, circular, deque, and priority queues. Additionally, it explains the characteristics and processing rules of priority queues.

Uploaded by

kentbaguio2234
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views16 pages

Queue

The document provides an overview of queues, a fundamental data structure that operates on a First In, First Out (FIFO) principle. It details various operations of queues, applications in computing such as job scheduling and event handling, and types of queues including linear, circular, deque, and priority queues. Additionally, it explains the characteristics and processing rules of priority queues.

Uploaded by

kentbaguio2234
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Coding School 2023

QUEUE
CC214 - DATA STRUCTURES AND ALGORITHMS
Coding School 2023

QUEUE
• A queue follows the First In, First Out
(FIFO) principle, making it a
fundamental data structure.
• It's a collection where new elements
are added and existing ones are
removed at opposite ends.
• The addition end is called the rear, and
the removal end is called the front.
Coding School

Operations of queue
• enqueue (Insert): Adds an element to the rear of
the queue.
• dequeue (Remove): Removes the element from
the front of the queue.
• front: Retrieves the element at the front of the
queue without removing it.
• rear: Retrieves the element at the rear of the
queue without removing it.
• is_empty: Checks if the queue is empty.
Coding School

Applications of Queue
• Job scheduling in operating systems involves
using queues to manage and schedule processes
or tasks.
• Print Queue: In a printing system, print jobs are
often placed in a queue.
• Task Management in Operating Systems: Queues
are used to manage tasks or threads in various
operating systems
• Breadth-First Search (BFS): Queues are
fundamental in graph algorithms like BFS.
• Buffer Management: In computer networking,
queues are used for buffering data packets.
Coding School

Applications of Queue(cont...)

• Task Scheduling in Real-time Systems: Queues


are employed to manage and schedule tasks in
real-time systems, ensuring timely execution of
critical tasks.
• Call Center Systems: In call centers, incoming
calls are often placed in a queue until a customer
service representative becomes available to
handle the call
• Print Spooling: Queues are used in print spooling
systems to store print jobs until the printer is
ready to process them.
Coding School

Applications of Queue(cont...)

• Event Handling: Queues can be used in event-


driven systems to manage events and messages.
• Data Buffering: Queues are used as buffers to
temporarily store data in scenarios where the
producer and consumer operate at different
rates.
• Transaction Processing Systems: In database
systems, queues can be used to manage
transactions, ensuring that they are processed in
a consistent and orderly manner.
• Task Queues in Parallel Computing: In parallel and
distributed computing, task queues are often used to
distribute and manage computational tasks among
multiple processors or nodes
Coding School 2023

TYPPES OF
QUEUES
• Linear
• Circular
• Deque
• Priority
• Multiple
Coding School

Linea Queue
• A linear queue, a fundamental type in
computer science, adheres to the First In,
First Out (FIFO) principle.
• It's a basic data structure with elements
arranged sequentially.
• In a linear queue, elements are inserted
at one end and dequeued from the
opposite end.
Coding School

Linear Queue
Coding School

Circular Queue
• A circular queue, or circular buffer, is a
queue data structure where the last
element is connected to the first, creating
a circular arrangement.
• In a circular queue, elements form a
circle, and two pointers, front and rear,
manage positions for enqueue and
dequeue operations.
Coding School

Circular Queue
Coding School

Double Ended Queue(DEQUE)


• Allows insertion and deletion of elements
from both ends.
• It is a versatile and flexible structure that
combines the features of both stacks and
queues.
Coding School

Double Ended Queue(DEQUE)


Coding School

Priority Queue
• A priority queue is a data structure in which
each element is assigned a priority.
• The priority of the element will be used to
determine the order in which the elements will
be processed.
Coding School

Priority Queue (cont....)


• The general rules of processing the elements of
a priority queue are:
⚬ An element with higher priority is processed
before an element with a lower priority.
⚬ Two elements with the same priority are
processed on a first-come-first-served
(FCFS) basis.
Coding School

Priority Queue (cont....)

You might also like