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

Q12. Given is the following priority queue (heap). It is a \"max heap\", which i

ID: 3903731 • Letter: Q

Question

Q12. Given is the following priority queue (heap). It is a "max heap", which is to say that the root value is the maximal value, and at each node, the parent value is larger than the value of the left and right child. 45 12 Which is the vector representation of the priority queue after another value 39 has been inserted? (a) 45,37,39,21,17,23,16,11,8,9,12,7 (b) 45,37,23,39,21,17,7,16,11,8,9,12 (c) 45,39,37,23,21,17,7,16,11,4,9,12 (d) None of the above Q13. If the vector corresponding to the maxheap of Q12 (before insertion of value 39) is passed as parameter to the constructor of a minheap data structure (parent values smaller than left and right child), and the "buildHeap" function is applied to min-heapify the initial vector, which vector will represent the resulting minheap? (a) 7,9,11,37,21,9,17,12,16,23,45 (c)78,9,11,12,16.17,21,23,37,45 (b) 7,8,16,11,9,23,45,37,21,17,12 (d) None of the above Q14. In terms of the functionalities provided by the public interfaces of both abstract data structures, the priority queue is more similar to which of these other data structures? (c) Set (d) Map (a) Stack (b) Linked List Q15. In the programming language Python, a data structure called "dictionary" allows the association of two types of data. For example, book titles with years of publications: ("The Sympathizer" 2015, "Ghost Ship2004, "The Myths of Security" 2009). Which C++ data structure is similar to Python's dictionary? (a) Vector (b) Priority Queue (c) Map (d) Set

Explanation / Answer

Q12- The vector representation will be

45,37,39,21,17,23,16,11,8,9,12,7

Q13-Resultant min heap will be

7,8,16,11,9,37,17,45,21,23,12

so the answer is none of the above

Q14- it is similar to Linked List .

Q15- It will be map as map has each key mapped to a value so book titles with years will be best implemented by Map.