Date: | 3-03-2017 |
---|---|
Deadline: | 11-03-2017 23:59 |
You must implement a heap and priority queue API and use them to write a waiting queue manager.
You will construct a program queue that demonstrates your heap and priority queue API. The required behavior of the program is given in the following section.
It is strongly recommended to implement your heap structure as an array. We provide a dynamic array implementation in array.h and array.c. We advise you to use these array functions to implement your heap.
You must submit your work as a tarball [1]. Next to the source code, your archive must contain a text file file named “AUTHORS” containing your name and Student ID(s).
[1] | http://lmgtfy.com/?q=how+to+make+a+tarball |
Your program will manage queuing at a Doctor's office which does not take appointments. The situation at this office is as follows:
To translate this into a program, you will work with the following:
A typical day of 10 hour long sessions in the doctors office is shown below. Carl, Bob, Albert and Barbara show up early and get treated by the doctor in alphabetical order. Jim, Tom and Zoe arrive late in the day, so Tom and Zoe leave without being treated:
Input | Output |
---|---|
Carl 22 Bob 68 Albert 35 . |
Albert . |
Barbara 40 . |
Barbara . |
. | Bob . |
. | Carl . |
. | . |
. | . |
. | . |
Alice 28 . |
Alice . |
. | . |
Jim 30 Tom 31 Zoe 29 . |
Jim . |
Tom Zoe |
Your grade starts from 0, and the following tests determine your grade:
The following extra features will be tested to obtain higher grades, but only if you have obtained a minimum of 5 points on the list above already:
+1.5pt if your queue program accepts a single command-line argument -y which causes, when specified, to change all the patient processing based on age to pick the youngest patient instead of alphabetical order. Patients leaving at the end of the day are also sorted by increasing age.
+1.5pt if your queue program also accepts a duration of the patient's appointment on the input (after the age), and keeps the doctor busy for that duration when that patient is picked. If a patient is still being treated at the end of the day their treatment is not completed and the patient is forced to leave first. An example with the duration extension is shown below:
Input | Output |
---|---|
Zoe 22 4 . |
. |
Martha 50 1 . |
. |
. | . |
Albert 11 1 . |
Zoe . |
. | Albert . |
. | Martha . |
etc.. |