Lab Exercise 6 Queues
Lab Exercise 6 Queues
Lab Exercise 6 Queues
ITDSTRUCL
(DATA STRUCTURES AND ALGORITHM)
EXERCISE
6
IMPLEMENTING CIRCULAR QUEUE
<student name>
<date performed>
<date submitted>
<submitted to>
I. Objectives:
At the end of the experiment students must be able to:
Cognitive
a.) Understand the execute technique of queues.
.
Psychomotor:
a.) construct a program that simulates a circular queue.
b.) implement a circular queue using arrays
c.) compile and debug the error of the program
Affective
a.) appreciate the concept behind this experiment
II. BACKGROUND INFORMATION
A queue is logically a first in first out (FIFO or first come first serve) linear data structure. The
concept of queue can be understood by our real life problems. For example a customer come and
join in a queue to take the train ticket at the end (rear) and the ticket is issued from the front end
of queue. That is, the customer who arrived first will receive the ticket first. It means the
customers are serviced in the order in which they arrive at the service centre.
The basic operations that can be performed on queue are
1. Insert (or add) an element to the queue (push)
2. Delete (or remove) an element from a queue (pop)
Simulation of a circular queue:
Enqueue
Dequeue
Display Queue
Exit
Enter a number: 1
Queue: 1
Front: 1
Rear: 1
2. Dequeue
Remove the data in Front. Display the new Queue, Front, and Rear
Queue: 2 3 4 5
Front: 2
Rear: 5
3. Display Queue
2 3 4 5
Front: 2
Rear: 5
V. REFLECTIONS:
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
__________________________________________________________________________