CMSC 341 Midterm 2 UPDATED ACTUAL
Questions and CORRECT Answers
What operations are required to splay the node with key 80? (see quiz 4 #1) - CORRECT
ANSWER - zig-zag (right rotation - left rotation)
In a priority queue, the items leave the queue in the order that they arrived. - CORRECT
ANSWER - False
What is the array representation of nodes for the following heap data structure in an array
implementation? (see quiz 4 #3) - CORRECT ANSWER - DKQZSY
In a unsorted list implementation of priority queue, the worst case running time of removal
operations is ... - CORRECT ANSWER - O(n)
In a priority queue ADT, the smallest key always has the highest priority. - CORRECT
ANSWER - False
The height of a Heap data structure is ... - CORRECT ANSWER - O(log n)
In the C++ STL class "std::priority_queue" the insertion operation is called ... - CORRECT
ANSWER - push (...)
The following tree is not a complete tree. (see quiz 4 #8) - CORRECT ANSWER - True
Which one is the final shape of the min-heap after inserting the node B in the following min-
heap? (see quiz 4 #9) - CORRECT ANSWER - c
The storage space of a Heap data structure is O(log n). - CORRECT ANSWER - False, it
is O(n)
Questions and CORRECT Answers
What operations are required to splay the node with key 80? (see quiz 4 #1) - CORRECT
ANSWER - zig-zag (right rotation - left rotation)
In a priority queue, the items leave the queue in the order that they arrived. - CORRECT
ANSWER - False
What is the array representation of nodes for the following heap data structure in an array
implementation? (see quiz 4 #3) - CORRECT ANSWER - DKQZSY
In a unsorted list implementation of priority queue, the worst case running time of removal
operations is ... - CORRECT ANSWER - O(n)
In a priority queue ADT, the smallest key always has the highest priority. - CORRECT
ANSWER - False
The height of a Heap data structure is ... - CORRECT ANSWER - O(log n)
In the C++ STL class "std::priority_queue" the insertion operation is called ... - CORRECT
ANSWER - push (...)
The following tree is not a complete tree. (see quiz 4 #8) - CORRECT ANSWER - True
Which one is the final shape of the min-heap after inserting the node B in the following min-
heap? (see quiz 4 #9) - CORRECT ANSWER - c
The storage space of a Heap data structure is O(log n). - CORRECT ANSWER - False, it
is O(n)