Programming language USING AVL TREE

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter20: Queuing Theory
Section: Chapter Questions
Problem 17RP
icon
Related questions
Question
100%

In Python Programming language USING AVL TREE

 

Building an automatic appointment reservation system for a very busy heart surgeon in the city. The system is going to work as follows:

The patient requests for an appointment time. The system looks through the list of appointments and if there are no appointments scheduled within 10 minutes either way of the requested time, then that appointment is added to the list of appointments along with the patient ID. Otherwise, the patient is given the next available time automatically that is not within 10 minutes of any other scheduled appointment.

At the appointed time, the appointment is marked as serviced and deleted from the list of appointments.

You must use an AVL Tree to implement this appointment system. The reservation system should run as follows:

It should run for a total of 12*25*60 minutes.

 At each time instant, there is a 10% probability that a new request comes in. If a new request comes in, generate a random number between the current time and (current time + 1000) for the value of the patient request time. A unique patient ID is also generated and the (appointment time, patient ID) is added as a (key, value) pair to the AVL Tree.

To do the 10-minute check, what you can do is that during insertion, on the path from the root while looking for a place to insert the new node, if any node is encountered that is within 10 minutes of the desired time, then you know that the 10-minute check has failed. In that case, use the find_range(…) function of your AVL Tree class to automatically find the next available time and add it to the AVL Tree.

After every 100 time instances, display the number of appointments scheduled in the next 100 minutes.

At the end of the simulation, display the average time between a patient’s requested time and the time he ended up being allotted.

Also, display the number of patients who were serviced and how many appointments are still in the AVL Tree at the end of the simulation.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Topological Sort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole