0 of 10 questions completed
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
0 of 10 questions answered correctly
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
What will be the output of the following program?
create an empty priority queue
As an answer, provide a sequence of integers separated by spaces.
Assume that you know in advance that in your application there will be n calls to Insert and calls to ExtractMax. Which of the following two implementations of the priority queue is preferable in this case?
Is it a binary max heap?
Assume that initially a binary max-heap H contains just a single node with value 0. Then, for all i from 1 to n, we insert i into H. We do this by attaching a new element to some leaf of the current tree. What will be the height of the resulting tree?
How many edges of this binary tree violate the min-heap property? In other words, for how many edges of the tree, the parent value is greater than the value of the child?
This binary tree contains 13 nodes, and hence we have 13 subtrees here (rooted at each of 13 nodes). How many of them are complete?
Consider a complete binary tree represented by an array [19,14,28,15,16,7,27,15,21,21,5,2].
How many edges of this tree violate the max-heap property? In other words, for how many edges of the tree, the parent value is smaller than the value of the child?
Assume that a max-heap with 105 elements is stored in a complete 5-ary tree. Approximately how many comparisons a call to Insert() will make?
Assume that a max-heap with 106 elements is stored in a complete 7-ary tree. Approximately how many comparisons a call to ExtractMax() will make?
Assume that we represent a complete d-ary tree in an array A[1…n] (this is a 1-based array of size n). What is the right formula for the indices of children of a node number i?