December
1999 QUESTION 3 Total Marks: 15 Marks |
Click here to access other
questions
Click to access |
You are to implement a system which will manage patients in a doctor s waiting room. When a patient arrives in the waiting room,a record is entered in a queue which contains the patient s name,the order number in which they arrived in the waiting room, and their condition,which can take one of the following values: trivial , concerning , or critical . The following data type is used to store this information:
|
||||||||||||||
(a) |
Briefly explain what is meant by a Circular Queue .
|
[2] |
||||||||||||
(b) |
Write a procedure, called AddPatient , the signature of which is given below,which takes a queue of patients and a new patient record, and adds the new record to the patient queue.The order number associated with a given patient is one greater than the order number associated with the previous patient.You may use the standard queue function EmptyQueue ,the signature of which is given above.
|
[6] | ||||||||||||
(c) |
Write a function,called Emergencies ,the signature of which is given below, which will take as a parameter the patient queue, and will return a second queue which contains all of the patients whose conditions are Critical .These patients should be removed from the original queue.You can assume the standard queue function, RemovePatient , which removes and returns the patient at the head of the queue.
|
[7] |