3) A heap is being stored in an array. A heap may be a minimum heap or a maximum
ID: 3704777 • Letter: 3
Question
3) A heap is being stored in an array. A heap may be a minimum heap or a maximum heap. Which would you use to implement a non-increasing [in-place] sort? 4) Situation: The order in which patients at a certain emergency room are seen by the doctor is based on arrival time minus 10 minutes for each major wound, minus 5 minutes for each minor wound, and plus 3 minutes for each time the patient annoys the nurse. You can assume a maximum wait time of 2 days. If a priority queue is used in the software at the nurses' station, would you use a minimum heap or a maximum heap to implement the priority queue? Thought-provoker: Do you think if you annoyed the nurse enough, s/he would smack you around enough for you to move to the head of the line?) 5) A heap data structure: A) always has the maximum key value in the root of the tree B) could really use a maid every other Thursday C) is always stored in an array D) must be a full tree E) needs parent pointers if not stored in an arrayExplanation / Answer
Ques 3. A heap sort algorithm works in a way that
If we want the sorted order in non-increasing order, then the first element should be the smallest in the current heap ehich is in the case of minimum heap;
SO, we would use min heap.
Ques 4. We would use the min heap as the person whose time is minimum would be seen first. If there is major wound, we subtract 10 min , if it is minor wound, we subtract 5 min. So, more the time is subtracted, more is the chnce of the person to be seen by the doctor fist.
Ques 5. Answer : (E)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.