P3a - Activities
P3a - Activities
P3 | Data Structures
P3a | Queues
Objectives:
Activity 1
In a restaurant, the dessert chef must make the desserts in the order that they are requested
by the waiting staff.
Complete the table to show the missing items based on the information in each column.
Note:
is the queue
isEmpty() [‘ ‘,’ ‘,’ ‘,’ ‘,’ ‘] 0 -1 0
empty?
enQueue(Y),
add Y, add M [Y,M,’ ‘,’ ‘,’ ‘] 2 1 0 Nothing
enQueue(M)
Add T
add G, add S
how many
elements in the
queue?
remove 1
P3a – Queues A Level Computer Science (AQA 7517)
P3 – Data Structures Wakefield College
Question Answer
How do you tell if the queue is
full?
Are there any problems with this
implementation of the queue
ADT as a static array?
P3a – Queues A Level Computer Science (AQA 7517)
P3 – Data Structures Wakefield College
Activity 2
A print server keeps all submitted jobs in a circular queue.
Complete the table for a server to show the missing print jobs based on the information in
the first column.
Note:
Queue
Initialise 0 -1 0
Add J38
Add J92
Remove 1
Remove 1
Add J44
Add J55
Add J66
Add J77
Remove 1
Add J04
Remove 1
Remove 1
Question Answer
How many are there in the
queue at the end?
Where is the front of the queue
at the end?
P3a – Queues A Level Computer Science (AQA 7517)
P3 – Data Structures Wakefield College
Activity 3
An accident and emergency room triage system rates each new patient according to a 3
point system. One is the highest priority and 3 is the lowest priority. A priority queue is
maintained of patients in the order that they are to be seen. (You can assume that the queue
will always be long enough to accommodate all patients, and that the first to be seen will
always be at q[0].)
Complete the table for an accident and emergency department to show the missing items
based on the information in the first column.
Note:
Queue q
Add 2HG
Add 3DA
Add 1NB
Add 2NF
Remove 1
Remove 1
Add 3FC
Add 2AB
Add 1WT
Remove 1
Add 2CS
Remove 1
Add 3DS