Search Header Logo

DAY-4 DSA BOOTCAMP HEAP

Authored by ATHARVA GALNE

Computers

University

Used 1+ times

DAY-4 DSA BOOTCAMP HEAP
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Given two max heaps of size n each, what is the minimum possible time complexity to make a one max-heap of size from elements of two max heaps?

O(n^2)

O(nLogLogn)

O(n)

O(nLogn)

Answer explanation

We can build a heap of 2n elements in O(n) time. Following are the steps. Create an array of size 2n and copy elements of both heaps to this array. Call build heap for the array of size 2n. Build heap operation takes O(n) time.

2.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Which of the following Binary Min Heap operation has the highest time complexity?

Inserting an item under the assumption that the heap has capacity to accommodate one more item

Merging with another heap under the assumption that the heap has capacity to accommodate items of other heap

Deleting an item from heap

Decreasing value of a key

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider a max heap, represented by the array: 40, 30, 20, 10, 15, 16, 17, 8, 4. Now consider that a value 35 is inserted into this heap. After insertion, the new heap is

40, 30, 20, 10, 15, 16, 17, 8, 4, 35

40, 35, 20, 10, 30, 16, 17, 8, 4, 15

40, 30, 20, 10, 35, 16, 17, 8, 4, 15

40, 35, 20, 10, 15, 16, 17, 8, 4, 30

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following array of elements. 〈89, 19, 50, 17, 12, 15, 2, 5, 7, 11, 6, 9, 100〉. The minimum number of interchanges needed to convert it into a max-heap is

4

3

5

2

5.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What is the time complexity of Build Heap operation? 
(Build Heap is used to build a max(or min) binary heap from a given array. Build Heap is used in Heap Sort as a first step for sorting.)

O(nLogn)

O(n^2)

O(n)

O(logn)

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Suppose we are sorting an array of eight integers using heapsort, and we have just finished some heapify (either maxheapify or minheapify) operations. The array now looks like this: 16 14 15 10 12 27 28 How many heapify operations have been performed on root of heap?

1

2

3 or 4

5 or 6

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Suppose the elements 7, 2, 10 and 4 are inserted, in that order, into the valid 3- ary max heap found in the above question, Which one of the following is the sequence of items in the array representing the resultant heap?

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

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

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

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

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?