Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

083 63 Us 0. 63 33 giving examples. [04 marks] Consider the following scenario a

ID: 3909732 • Letter: 0

Question

083 63 Us 0. 63 33 giving examples. [04 marks] Consider the following scenario and answer the questions given below. Scenario : A hospital needs to keep tracks of appointments at an Out Patient Department (OPD) which operates from 8:30 AM to 09:30 AM. Assume that the key entry is the time of the appointment made. There are five doctors deployed at OPD, that allows five patients to be consulted at once. Doctor is expected to examine one patient for 15 minutes. Patient's name, mobile number and the age should be recorded when the appointment is made. j. Select the appropriate implementation between Array and Linked List. Justify your answer. [02 marks] i. Define the structure of the Array / Linked List and the Node. Based on your selection in part i. [02 marks] iii. Augment the implementation to fulfill above requirements by defining only the functions that are necessary. Give your assumptions. Give the validity criteria clearly. [Complete implementation should be given using pseudo codes)[04 marks] iv. Assume the following series of appointments. Illustrate using diagrams, how the insertion of the given set would be handled using the function defined in part iii. Appointments : 08:30 09:00 08:45 09:15 08:45 08:30 08:50 09:00 09:00 08:45 09:15 09:15 09:00 09:15 08:15 09:00 08:45 09:00 08:45 08:30 [04 marks] v. Discuss inefficiencies of the above implementation. [02 marks] [P.T.O.

Explanation / Answer

(i) Linked list should be used for implementation. As, After the appointment is given to a patient, the doctor may take more than 15 minutes to operate the patient. therefore, there can be chanves that patient given appointment first may get freed later. therefore, such appointments are to be deleted from set as, they are completed. and also deletion in arrays is costly if it is not from end. Therefore, linked list is the efficient choice.

(ii) Structure of linked list is as follows:

Struct Patient

{

String name,time,release_time;

long int mobile;

int age;

Patient *next;

}

(iii) Necessary functions :

1. boolean addPatient(Patient **new_patient,String name,long int mb,int age,String time,String release_time);

This function will add new node into linked list "Patient" as the request for new appointment will come, based on the time of appointment insertion of node is done at appropriate place . and if node is added successfully, this function will return true, else if there is clash in appointment timings then node wont be inserted and function will return false. and also, if size of linked list is already 5 then function wont insert node.

2. int removePatient(Patient **p,String time,String name);

This function will remove the patient from the list of patients and will return the count of left patients in the list(Size of linked list after deletion).

3. Patient *getPatientDetails(String name,String time);

This function will return patient details if it is there in the list , This will search on basis of name and slot(time) given.

This function will return complete node which will contain complete details of that patient , therefore, Patient* is given as its return type.

4. Patient **updatePatient(String name,String time);

This function will update the details of patient as given in parameters. and will return the updated complete patient detail which is actually a node of linked list that's why its return type is Patient**.

(v) inefficiencies:

One node of linked list is storing various information, which is making it complex

It is not able track what appointment is completed after 15 minutes, hence, manual deletion has to be done

also, array of linked list should be used as the data structure

Array of size 5 would represent 5 doctors and each doctor can have any number of patients therefore, linked lost can be used as, its size should grow dynamically.