Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Priority Queue Class You will use a priority queue of patients to determine the order that patients are seen by the doctor. Before writing

The Priority Queue Class 

You will use a priority queue of patients to determine the order that patients are seen by the doctor. Before writing the code to simulate the emergency room, you should implement the priority queue as below. Remember to test the priority queue as you develop it. 

  • • Your priority queue must be implemented using a heap of Patients. 
  • • The public methods for your priority queue will be insert (add a new item to the queue), deleteMax (remove the highest priority item from the priority queue), peek (peek at the highest priority item in the priority queue), and isEmpty. 
  • • The highest priority patients should be located at the top of the heap (front of the priority queue). 
  • • The isEmpty method will return true if the queue contains no items and false otherwise. 
  • • The insert method will insert a patient into the priority queue, so that the highest priority patient is at the front of the queue (i.e. you will pass insert a Patient object). 
  • • The deleteMax method will return the patient at the front of the priority queue (i.e. deleteMax will return a Patient object), and will remove that patient from the queue. 
  • • The peek method will return the patient at the front of the priority queue, but will leave that patient in the queue. 
  • Using these methods from queue library is not allowed!!!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Answer Below is a Python implementation of a priority queue using a heap of Patients class Patient d... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Management Science A Modeling And Cases Studies Approach With Spreadsheets

Authors: Frederick S. Hillier, Mark S. Hillier

5th Edition

978-0077825560, 78024064, 9780077498948, 007782556X, 77498941, 978-0078024061

More Books

Students also viewed these Operating System questions

Question

c. What is the persons contact information?

Answered: 1 week ago