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

For each of the following questions, indicate which data structure would be best

ID: 3699919 • Letter: F

Question

For each of the following questions, indicate which data structure would be best suited to handle each scenario. Your choices are ArrayList, LinkedList, Stack, Queue, Tree, and Priority Queue. 1. (3 points) You need to model which patient should be seen next at a hospital. Patients should be seen in as close to the order of arrival, but patients in a more severe situation should be seen first. 2. (3 points) A router needs to hold packets in a buffer and deal with them in the order they appear. 3. (3 points) You need to model a hierarchy. (3 points) You need a data structure to hold your previous decisions in case you need to backtrack

Explanation / Answer

Answer 1.

Priority queue ( is the Best option).

In simple priority queue insertion is performed in the order of arrival and deletion (Admit ) is performed based on the priority. As the patient arrive they are queued in the order having the same priority but the severe patient with highest priority is send directly to the admission.( called deletion Operation) - Priority queue is a sub- part of tree.

Answer . 2 Queue is the Best Option ( Best Option )

In the router concept the data packets are being stored into the packet. to revive the original data it is must and necessarily maintain the order of their datastream packets. Therfore queue provides the best option as it maintains the order of the packets.  

Answer.3    Tree ( Best Option)

As in hirearchy no fix amout of child element is being fixed. In all the other data structure we need to have a speciefied amount of element at a respective position. but queue can handle this Situation of the hierarchial Ordering.

Answer. 4 Tree( Best Option )

Back tracking is called dept -first tree seaching. so if we need to bask track the elements stored in the datastrucure in storing previous decision we need to use the tree concept.

Diagram for each case is done.

  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote