Programming language USING AVL TREE

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education