This assignment is based on an assignment written by instructors at Stanford University. It represents a lot of hard work by the lecturers at Stanford University who have taught CS106B/X over the years. Due: Wednesday 4/7 by 11:30PM Submission: • PatientQueue.java - implementation of a Patient Queue. Overview The goal of this assignment is to practice implementing your own data structure. Specifically you will implement a priority queue using a binary minimum heap. Remember to use good coding practices. Decompose common code into separate private helper functions. We hope you have gotten plenty of practice with generics by now. So for this assignment, your priority queue will be specific to Patient objects. You will not need to make it generic.
QQ1703105484
Assignment You will write a class called PatientQueue. In this class we have learned about queues that process elements in a first-in, first-out (FIFO) order. But FIFO is not the best order to assist patients in a hospital, because some patients have more urgent and critical injuries than others. As each new patient checks in at the hospital, the staff assesses their injuries and gives that patient an integer priority rating, with smaller integers representing greater urgency. (For example, a patient of priority 1 is more urgent and should receive care before a patient of priority 2.) Once a doctor is ready to see a patient, the patient with the most urgent (smallest) priority is seen first. That is, regardless of the order in which you add/enqueue the elements, when you remove/dequeue them, the one with the most urgent priority (smallest integer value) comes out first, then the second-smallest, and so on, with the least urgent priority (largest integer value) item coming out last. A queue that processes its elements in order of increasing priority like this is also called a priority queue. For a binary minimum heap, the element with the minimum priority value is frontmost. That is, regardless of the order in which you add/enqueue the elements, the minimum priority element is dequeued first, then the second-smallest, and so on, with the largest priority element coming out last.