QUEUES - PowerPoint PPT Presentation

About This Presentation
Title:

QUEUES

Description:

plum. grape. front. kiwi. Queue. DEQUEUE. The queue delete operation is know as dequeue ... plum. kiwi. grape. front. kiwi. grape. Dequeue. Operation. Queue ... – PowerPoint PPT presentation

Number of Views:608
Avg rating:3.0/5.0
Slides: 9
Provided by: technology2
Learn more at: http://www.cs.loyola.edu
Category:
Tags: queues | plum

less

Transcript and Presenter's Notes

Title: QUEUES


1
QUEUES
Sarah Swiss
2
Queue is a linear list in which data can only be
inserted at one end, called the rear, and deleted
from the other end called the front. These
restrictions ensure that the data are processed
through the queues in the order in which they are
received. A queue is the same as a line.
3
Examples of Queues
Insert (enqueue)
a. A queues (line) of people
Remove (dequeue)
b. A computer queue
4
Although there are many operations for queue,
three are basic ENQUEUE DEQUEUE EMPTY
5
The queue insert operation in know as enqueue
Queue
plum
kiwi
Enqueue
Operation
grape
ENQUEUE
plum
grape
front
kiwi
Queue
After the data has been inserted into the queue,
the new element becomes the rear. The only
potential problem with enqueue is running out of
room for the data. If there is not enough room
for another element in the queue, the queue is in
overflow state
6
The queue delete operation is know as dequeue
Queue
front
plum
kiwi
grape
Operation
Dequeue
DEQUEUE
front
kiwi
grape
Queue
The data at the front of the queue are removed
from the removed the queue and returned to the
user. If there is no data in the queue when
dequeue is attempted, the queue is in an
underflow state.
7
This operation check to see if a queue is empty
or not. The result is true or false.
Example 2
Show the result of the following operation on a
queue Q
enqueue (Q,23) If not empty (Q), dequeue
(Q) enqueue (Q,20) Enqueue (Q,19) If not empty
(Q), dequeue (Q)
EMPTY
Solution
front
front
23
front
Q
Q
Q
front
front
front
20
20
19
19
Q
Q
Q
8
A queue can be implemented as either an array or
a linked list Queues are one of the most common
of all data processing structures. They are found
in virtually every operating system and network
and in countless other areas. They are used in
business online applications such as processing
customer requests, jobs, and orders. In a
computer system, a queue is needed to process
jobs and for system services such as print
spools.
Write a Comment
User Comments (0)
About PowerShow.com