Time limit: 0

0 of 10 questions completed

Questions:

- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10

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:

Quiz complete. Results are being recorded.

0 of 10 questions answered correctly

Your time:

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)

- Not categorized 0%

- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10

- Answered
- Review

- Question 1 of 10
##### 1. Question

What will be the output of the following program?

create an empty priority queue

Insert(18)

Insert(12)

Insert(14)

print(ExtractMax())

print(ExtractMax())

Insert(15)

print(ExtractMax())

Insert(10)

print(ExtractMax())

print(ExtractMax())As an answer, provide a sequence of integers separated by spaces.

CorrectIncorrect - Question 2 of 10
##### 2. Question

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?

CorrectIncorrect - Question 3 of 10
##### 3. Question

Is it a binary max heap?

CorrectIncorrect - Question 4 of 10
##### 4. Question

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?

CorrectIncorrect - Question 5 of 10
##### 5. Question

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?

CorrectIncorrect - Question 6 of 10
##### 6. Question

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?

CorrectIncorrect - Question 7 of 10
##### 7. Question

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?

CorrectIncorrect - Question 8 of 10
##### 8. Question

Assume that a max-heap with 10

^{5}elements is stored in a complete 5-ary tree. Approximately how many comparisons a call to Insert() will make?CorrectIncorrect - Question 9 of 10
##### 9. Question

Assume that a max-heap with 10

^{6}elements is stored in a complete 7-ary tree. Approximately how many comparisons a call to ExtractMax() will make?CorrectIncorrect - Question 10 of 10
##### 10. Question

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?

CorrectIncorrect